我的logrotate的custom.conf文件只执行旧文件的重命名,但是在我的maxage日之后没有处理它们。我可以看到它旋转文件。 custom.conf文件保存到/etc/logrotate.d/目录。有人可以告诉我,如果我在这里遗失了什么? 它只是继续在我的日志文件末尾添加以前的日期* .log-20180428-20180430-20180502-20180504。
以下是custom.conf文件(注意:directory_name路径是已装入的驱动器。)
/directory_name/*/*/*.log*
/directory_name/*/*.log*
{
daily
compress
delaycompress
rotate 4
ifempty
maxage 4
nocreate
missingok
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd-ng.pid 2> /dev/null` 2> /dev/null || true
endscript
}
答案 0 :(得分:0)
/etc/logrotate.conf
文件不应该以{{1}}和{
开头和结尾。
可能不需要}
和maxage
(我总是只使用rotate
,而不是rotate
)。
在maxage
之前应该有一个文件名,如下所示:
{
您应该在/var/log/mylog {
...
}
文件夹中添加和更改文件,而不是更改/etc/logrotate.d
文件。 (保护更好地防止系统升级的自动更改我认为,更清洁)