我想限制日志文件的大小,如果超过该大小,则旧消息将像环形缓冲区一样被静默删除。
我认为output channel不符合我的要求。
那我该怎么办?
有关更多信息,我为syslogd找到了clog patch。
答案 0 :(得分:1)
使用旋转0仅保留一个文件
"/var/log/sample.log" {
minsize 9M
rotate 0
}
人旋转
rotate count Log files are rotated count times before being removed or mailed to the address specified in a mail directive. If count is 0, old versions are removed rather than rotated. If count is -1, old logs are not removed at all (use with caution, may waste performance and disk space). Default is 0.
答案 1 :(得分:0)
我的答案仅针对rsyslog。
进行循环日志的方法有很多,请参见this。
例如。
local7。* / var / log / messages
然后使用 omprog 将这些方式合并到rsyslog中。
local7。*操作(类型=“ omprog”二进制=“ / path / ways”)
我们可以使用多种方法将日志记录到循环缓冲区中。
再加上一个句子,因为循环格式是自定义的,因此需要相应的工具来加载内容。我认为这就是为什么rsyslog不支持这种正式插件的原因。