当前位置:首页 > 操作系统 > Linux

linux – logrotate包含日志文件的整个目录

有没有办法使用logrotate我可以旋转整个目录并压缩它而不仅仅是特定目录中的文件?我尝试使用下面的配置进行实验,但这不起作用.给出以下错误消息:

配置:

/path/to/folder/test {
daily
rotate 5
missingok
compress
delaycompress
}

错误:

$logrotate -vf test.conf
reading config file test.conf
reading config info for /path/to/folder/test

Handling 1 logs

rotating pattern: /path/to/folder/test  forced from command line (5 
rotations)
empty log files are rotated, old logs are removed
error: error creating unique temp file: Permission denied

解决方法:

Logrotate仅对目录中的单个文件进行操作,而不是作为单个实体的整个目录.最直接的解决方案是在该目录上调用gzip之类的cronjob,然后根据需要移动/删除文件.


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!