how to make `atop` create less log files?
Currently I have like 3.5GB of atop log files at/var/log/atop/
I do not need that much log data.
Files there are as old as 28 days ago.
I cannot find a way to configure atop
log limit/quota/age.
How to lower that disk space usage?
Solution 1:
Using this tip, I edited/etc/init.d/atop
As the manual page says "four weeks", it was clearly there this command:find $LOGPATH -name 'atop_*' -mtime +28 -exec rm {} \;
So, 28 days old files will be kept...
I changed it tofind $LOGPATH -name 'atop_*' -mtime +1 -exec rm {} \;
And ran this command:sudo service atop _cron
Now the logs are only at most for yesterday, that is what I need.
Solution 2:
Adding an answer for my version (also found in the man pages):
Ubuntu: 17.04
$ atop -V
Version: 2.2.6
The script is located: /usr/share/atop/atop.daily
I've dropped mine down to 7 days of logs.
38c38
< ( (sleep 3; find $LOGPATH -name 'atop_*' -mtime +28 -exec rm {} \;)& )
---
> ( (sleep 3; find $LOGPATH -name 'atop_*' -mtime +7 -exec rm {} \;)& )
Solution 3:
Always read the man
page. Always.
Do so by running
man atop
If you would have done so, you would have seen this:
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.