2

I installed atop version 1.26 on Ubuntu 12.04 server. By default, its sampling interval is 10 minutes. How can I change to 1 minute?

Also, how can I set the log path? Currently the logs are at /var/log/, but I notice that atop added a folder /var/log/atop/ (empty). How can I set the logs to be saved in this folder?

  • 1
    Adding this here since I have been searching for this forever, and this question has popped up consistently: On Ubuntu, the log retention time for atop logs is "hard"-coded into atop init.d script, you can find the line by searching for find within the script (default should be +28). – dualed Jan 18 '18 at 17:12
1

Correction: the default sampling interval for atop is 10 seconds; atop writes compressed binary data to /var/log/atop/atop_YYYYMMDD every 10 minutes.

Sampling intervals and log file locations can be set from the command line. To set the sample interval to one minute:

atop 60

Set compressed raw format log to foo.log:

atop -w foo.log
  • but how to change the log path to /var/log/atop/foo.log ? – Raptor Apr 13 '16 at 6:18
  • 1
    @Raptor, do we need to? Find out with: ps -A atop && lsof -p $(pidof atop) | grep log – agc Apr 13 '16 at 7:12
  • Although this is the accepted answer I believe it misses the point of the question which is about configuring atop with non-default settings and not running atop with non default settings. – ndemou May 16 at 7:16
  • @ndemou, Perhaps it is about configuring and not running atop, and Rifaideen's answer is more correct. If that is so, then the question should be revised, so that its wording makes the OP's true intent obvious. OTOH, the OP did accept this answer, so I dunno. "Plan B" would be to just ask another question about how to change atop log file location & default duration. – agc May 16 at 12:07
1

On Ubuntu 16.04 you can change the sampling interval in the /etc/default/atop file.

To change it to sample once a minute, edit the the file and set INTERVAL=60

You can also edit the location of the log files by setting the LOGPATH variable.

After editing the defaults, restart the atop daemon with this command:

systemctl restart atop.service

  • this does not seem to work on Raspbian 9 ` sudo systemctl restart atop.service sudo systemctl status atop.service Main PID: 1518 (atop) CGroup: /system.slice/atop.service └─1518 /usr/bin/atop -a -R -w /var/log/atop/atop_20190405 600 ` so it's still running at 10 min interval. Also /etc/default/atop file has comment "# this file is no longer used and will be removed in a future release" – Aleksandr Levchuk Apr 5 at 15:35
1
  1. Edit the file /etc/default/atop
  2. SET INTERVAl=60
  3. SET LOGPATH="/ur-desired-path", in this case LOGPATH="/var/log/atop"
  4. Restart the atop service systemctl restart atop.service

P.S. In Centos 7 I have atop's config file in /etc/sysconfig/atop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.