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

问题描述 投票:4回答:1

有没有办法使用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
linux unix logrotate
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.