使用Swatch进行自动化日志监控
1. logrotate的运行
通常, logrotate 由 /etc/cron.daily/logrotate 脚本调用,该脚本仅包含一个命令:
/usr/sbin/logrotate /etc/logrotate.conf
这并不一定意味着日志会每天轮转,而是 logrotate 每天会根据其配置脚本检查每个日志文件,并相应地决定是否轮转该日志文件。
如果你希望 logrotate 运行的频率更低,可以将该脚本移动到 /etc/cron.weekly 甚至 /etc/cron.monthly (不过,除非出于某些特殊原因, logrotate 被配置为每月轮转每个文件,否则不建议使用 /etc/cron.monthly )。
2. logrotate常用指令
| 指令 | 描述 |
|---|---|
| ifempty | notifempty | 默认情况下,即使文件为空, logrotate 也会轮转文件。 notifempty 取消此 |
超级会员免费看
订阅专栏 解锁全文
8

被折叠的 条评论
为什么被折叠?



