【发布时间】:2019-12-12 17:31:24
【问题描述】:
我有一个问题,我在 Centos7 中为 catalina.out 配置了每日 logrotation 但它没有旋转,如果强制运行 logrotate 它会旋转 catalina 但不是每天自动旋转。
logrotate.d/tomcat 配置文件:
/usr/local/tomcat7/logs/catalina.out
{
daily
rotate 30
missingok
compress
copytruncate
}
logrotate.conf:
# see "man logrotate" for details
# rotate log files daily
daily
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# use date as a suffix of the rotated file
dateext
# uncomment this if you want your log files compressed
#compress
# RPM packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
minsize 1M
rotate 1
}
/var/log/btmp {
missingok
monthly
create 0600 root utmp
rotate 1
}
# system-specific logs may be also be configured here.
logrotate 状态/调试:
rotating pattern: /usr/local/tomcat7/logs/catalina.out
after 1 days (30 rotations)
empty log files are rotated, old logs are removed
considering log /usr/local/tomcat7/logs/catalina.out
log does not need rotating (log has been already rotated)
"/usr/local/tomcat7/logs/catalina.out" 2019-8-5-9:25:18
【问题讨论】:
-
@user3788685 所以我不需要 logrotate 来旋转 catalina ,或者这对我有什么帮助?谢谢