gpt4 book ai didi

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

转载 作者:IT王子 更新时间:2023-10-29 00:43:30 26 4
gpt4 key购买 nike

有没有一种方法可以使用 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 仅对目录中的单个文件进行操作,而不是将整个目录作为单个实体进行操作。最直接的解决方案是一个 cronjob,它在该目录上调用类似 gzip 的东西,然后根据需要移动/删除文件。

关于linux - logrotate 包含日志文件的整个目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47066095/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com