看起来应该有效:
"/usr/local/tomcat/logs/" {
daily
compress
delaycompress
copytruncate
rotate 1
prerotate
/usr/bin/find /usr/local/tomcat/logs/ -name stupidLogWithTimestamp* -size -10k -delete
/usr/bin/find /usr/local/tomcat/logs/ -name stupidLogWithTimestamp* -mtime +3 -delete
endscript
}
我想对 3 天以内的日志进行 1 次轮换,并删除所有大小小于 10k 的内容。每当我尝试手动运行它时,我都会得到:
rotating pattern: "/usr/local/tomcat/logs/" forced from command line (no old logs will be kept)
empty log files are rotated, old logs are removed
一切都没有改变。我一直在搜索堆栈溢出,但找不到与此相关的任何内容。
答案1
我想到了。我必须在第一行使用正则表达式:所以这样:
"/usr/local/tomcat/logs/"
应该是这样的:
"/usr/local/tomcat/logs/stupidLogWithTimestamp*"