我发现将通配符与 logrotate 一起使用会给我空文件。我想找到一个不创建这些空文件的解决方案。非常感谢您的帮助
我的摘录
/etc/logrotate.d/tomcat
/Data/logs/localhost_* {
copytruncate
daily
rotate 7
compress
missingok
notifempty
size 10M
maxage 15
}
当我跑步时
/usr/sbin/logrotate /etc/logrotate.conf
du -sh ./*
1020K ./catalina.out
13M ./catalina.out-20191114.gz
84K ./localhost.2019-10-30.log
2,9M ./localhost_access_log2019-09-30.txt-14112019-20191115.gz
3,1M ./localhost_access_log2019-11-06.txt-20191115.gz
3,0M ./localhost_access_log2019-11-07.txt-20191115.gz
3,0M ./localhost_access_log2019-11-08.txt-20191115.gz
3,0M ./localhost_access_log2019-11-09.txt-20191115.gz
3,0M ./localhost_access_log2019-11-10.txt-20191115.gz
3,0M ./localhost_access_log2019-11-11.txt-20191115.gz
3,0M ./localhost_access_log2019-11-12.txt-20191115.gz
3,0M ./localhost_access_log2019-11-13.txt-20191115.gz
3,0M ./localhost_access_log2019-11-14.txt-20191115.gz
0 ./localhost_access_log2019-11-15.txt
1,1M ./localhost_access_log2019-11-15.txt-20191115.gz
2,1M ./localhost_access_log2019-11-15.txt-20191119.gz
0 ./localhost_access_log2019-11-16.txt
3,1M ./localhost_access_log2019-11-16.txt-20191119.gz
0 ./localhost_access_log2019-11-17.txt
3,1M ./localhost_access_log2019-11-17.txt-20191119.gz
0 ./localhost_access_log2019-11-18.txt
3,4M ./localhost_access_log2019-11-18.txt-20191119.gz
152K ./localhost_access_log2019-11-19.txt
1,3M ./localhost_access_log2019-11-19.txt-20191119.gz