Created
July 19, 2018 16:34
-
-
Save willwhui/8763c46ad1efa513094f1b189f19f3e1 to your computer and use it in GitHub Desktop.
Linux系统日志防爆
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Linux系统日志防爆 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
当系统有异常频繁发生的时候,日志就会疯狂膨胀,把磁盘空间耗尽。
此时会出现各种错误。
首先,进入/var/log目录,将大文件删除。
然后,编辑文件/etc/logrotate.conf,做以下修改:
当然,如果愿意的话,修改100M为更大或更小,都是可以的。
但是如果太小的话,我怀疑会产生问题:
如果日志生成得很疯狂的话,飞快地就超过大小限制了,
那么,
logrotate程序会不断的存档和删除,可能会导致设备运行缓慢,磁盘损耗,等问题。
如何应用修改的配置文件。
根据这里https://unix.stackexchange.com/questions/116136/how-to-make-log-rotate-change-take-effect
翻译:logrotate 通过crontab来工作。它是个计划任务,不是一个后台服务,所以不需要(手动)重新加载它的配置。