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

iDe*_*Dev 6 unix linux logrotate

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

配置:

/path/to/folder/test {
daily
rotate 5
missingok
compress
delaycompress
}
Run Code Online (Sandbox Code Playgroud)

错误:

$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
Run Code Online (Sandbox Code Playgroud)

par*_*tle 3

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