如何限制由syslog管理的日志文件的总大小?超过此大小限制(配额)时,可能应该删除最古老的归档日志文件。
一些日志文件是由LOG_LOCALn指定的自定义文件,但我想这与配额问题无关。
谢谢!
发布于 2014-04-01 01:38:04
Linux实用程序 log 定期重命名和重用系统错误日志文件,这样它们就不会占用过多的磁盘空间。Linux系统将与此相关的所有相关信息存储在/etc/logrotate.conf文件中。
有许多属性可以帮助我们管理日志大小。在做任何事情之前,请阅读手册(“人工日志旋转”)。在我的机器上,该文件如下所示:
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# uncomment this if you want your log files compressed
#compress
# packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp {
missingok
monthly
create 0664 root utmp
rotate 1
}
/var/log/btmp {
missingok
monthly
create 0660 root utmp
rotate 1
}
# system-specific logs may be configured here正如我们所看到的,日志文件将在每周旋转一次,basis.This可能会更改为在我的机器上不启用每日basis.The压缩。如果希望使日志文件大小更小,则可能启用此功能。有优秀的文章,您可能想要参考,以获得完整的理解这个主题。
https://stackoverflow.com/questions/22775148
复制相似问题