logging - logrotate:日志不需要旋转

标签 logging logrotate

logrotate 没有旋转我的日志

要验证日志文件不为空:

# ls -laFh /var/log/cisco-meraki.log
-rw-r----- 1 root adm 2.8G Sep  5 13:23 /var/log/cisco-meraki.log

配置(/etc/logrotate.d/zzzzz_default):
"/var/log/cisco-meraki.log" {
    daily
    rotate 10
    compress
    missingok
    notifempty
    create
}

全局配置(logrotate.conf):
daily
rotate 10
create
include /etc/logrotate.d
/var/log/wtmp {
    missingok
    monthly
    create 0664 root utmp
    rotate 1
}
/var/log/btmp {
    missingok
    monthly
    create 0660 root utmp
    rotate 1
}

尝试手动运行:
# logrotate --verbose -d zzzzz_default
reading config file zzzzz_default

Handling 1 logs

rotating pattern: "/var/log/cisco-meraki.log"  after 1 days (10 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/cisco-meraki.log
  log does not need rotating

为了验证问题不是“已经旋转”,我检查了:
# cat /var/lib/logrotate/status|grep cisco
"/var/log/cisco-ace.log" 2016-1-19-16:0:0
"/var/log/cisco-pix.log" 2016-1-19-16:0:0
"/var/log/cisco-acs.log" 2016-1-19-16:0:0
"/var/log/cisco-asa.log" 2016-1-19-16:0:0
"/var/log/cisco-router.log" 2016-9-6-0:1:1
"/var/log/cisco-ips.log" 2016-1-19-16:0:0

..但没有cisco-meraki.log

最佳答案

从 logrotate 手册页:

      -d, --debug
           Turns on debug mode and implies -v.  In debug mode, no
           changes will be made to the logs or to the logrotate
           state file.

我遇到了完全相同的问题!

N。

关于logging - logrotate:日志不需要旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40606797/

相关文章:

c# - Asp.net 核心 - 调用方法()不调用中间件

linux - Redhat 上的 Tomcat catalina.out logrotate 无法正常工作

logging - 自动日志轮转未执行

linux - logrotate 不根据大小旋转日志

python - 在线程中使用 Flask current_app.logger

java - 正则表达式匹配多行或其他解决方案?

tomcat - 如何在 Tomcat 中安装 cronolog 以进行每日日志轮换?

php - Yii2 始终使用 $_COOKIE、$_SESSION 和 $_SERVER 记录应用程序类别(类别过滤器无法正常工作)

python - 在Jinja扩展程序中进行优美的错误处理和日志记录