9

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?

1
  • any idea concerning why it was downvoted and got a close request? May 9, 2016 at 2:39

5 Answers 5

10

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 to
find $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.

5

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 {} \;)& )
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.
3
  • 2
    ls: cannot access /etc/atop/: No such file or directory May 8, 2016 at 23:33
  • 1
    may be it is outdated, that is the good thing on stackexchange, we get updated tips :), also it states "four weeks" as not being optional... that's too much log for my small HD. May 8, 2016 at 23:34
  • Why read the manpage when I can get the answer so much faster online?
    – isaaclw
    Nov 2, 2021 at 1:01
0

This solution works for Ubuntu and perhaps other systems as well:

Open the config file /etc/default/atop

It will look something like this

# /etc/default/atop
# see man atoprc for more possibilities to configure atop execution

LOGOPTS="-R"
LOGINTERVAL=10
LOGGENERATIONS=28
LOGPATH=/var/log/atop

LOGGENERATIONS is the number of days of history that will be stored (the config value is read by /usr/share/atop/atop.daily which will delete older log files)

You can change LOGGENERATIONS to a smaller number of days.

0

All of the given answers were true at some point, although atop seems to have changed the location of the config file multiple times. As @EEAA suggests, check man atop for the config location of your specific version.

For me on atop v2.7.1, the config is located under /etc/default/atop and provides all necessary info.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .