我想限制日志文件的大小,如果超过了该大小,则旧消息将像环形缓冲区一样被静默删除。
而且我认为output channel不符合我的要求。
所以,我该怎么办?
有关更多信息,我找到了syslogd的clog patch。
使用旋转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.
我仅对rsyslog的回答。
进行循环日志的方法很多,请参见this。
例如。
local7。* / var / log / messages
然后使用omprog将这些方式合并到rsyslog中。
local7。* action(type =“ omprog” binary =“ / path / ways”)
我们可以使用上述多种方法将日志记录到循环缓冲区中。
另外一句话,因为循环格式是自定义的,因此需要相应的工具来加载内容。我认为这就是为什么rsyslog不支持这种正式插件的原因。