目前我有3.5GB的atop日志文件
/var/log/atop/
我不需要那么多的日志数据。
那里的文件早在28天前。
我无法findconfiguration日志限制/配额/年龄的方法。
如何降低磁盘空间使用率?
使用这个技巧 ,我编辑了
/etc/init.d/atop
手册页上写着“四周”,显然有这个命令:
find $LOGPATH -name 'atop_*' -mtime +28 -exec rm {} \;
所以,28天的文件将被保留…
我改变了
find $LOGPATH -name 'atop_*' -mtime +1 -exec rm {} \;
并运行这个命令:
sudo service atop _cron
现在日志最多只有昨天,那就是我所需要的。
总是阅读man页。 总是。
如果你愿意的话,你会看到这样的:
When atop is installed, the script atop.daily is stored in the /etc/atop directory. This scripts takes care that atop is activated every day at midnight to write compressed binary data to the file /var/log/atop/atop_YYYYMMDD with an interval of 10 minutes. Furthermore the script removes all raw files which are older than four weeks. The script is activated via the cron daemon using the file /etc/cron.d/atop with the contents 0 0 * * * root /etc/atop/atop.daily When the RPM `psacct` is installed, the process accounting is automatically restarted via the logrotate mechanism. The file /etc/logrotate.d/psaccs_atop takes care that atop is finished just before the rotation of the process accounting file and the file /etc/logrotate.d/psaccu_atop takes care that atop is restarted again after the rotation. When the RPM `psacct' is not installed, these logrotate-files have no effect.
为我的版本添加一个答案(也可以在手册页中find):
Ubuntu:17.04
$ atop -V
版本:2.2.6
该脚本位于: /usr/share/atop/atop.daily
我已经把我的下落到了7天的原木。
38c38 < ( (sleep 3; find $LOGPATH -name 'atop_*' -mtime +28 -exec rm {} \;)& ) --- > ( (sleep 3; find $LOGPATH -name 'atop_*' -mtime +7 -exec rm {} \;)& )