使用linux的logwatch命令遍历系统日志

使用linux的logwatch命令遍历系统日志

小编给大家分享一下使用linux的logwatch命令遍历系统日志,希望大家阅读完这篇文章后大所收获,下面让我们一起去探讨吧!

logwatch命令是一个可定制和可插入式的日志监视系统,它通过遍历给定时间范围内的系统日志文件而产生日志报告。logwatch默认每天执行一次,可以从/etc/cron.daily里看到。

语法格式:logwatch [参数]

常用参数:

参考实例

只看sshd的日志情况:

[root@linuxcool ~]# logwatch --service sshd --detail High

查看sshd当天的日志情况:

[root@linuxcool ~]# logwatch --service sshd --detail High --range today

查看sshd昨天的日志情况:

[root@linuxcool ~]# logwatch --service sshd --detail High --range yesterday

查看sshd从2018年10月24日到2019年10月24日的日志情况:

[root@linuxcool ~]# logwatch --service sshd --detail High --range 'between 10/24/2018 and 10/24/2019'

看完了这篇文章,相信你对使用linux的logwatch命令遍历系统日志有了一定的了解,想了解更多相关知识,欢迎关注行业资讯频道,感谢各位的阅读!