6

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
  • 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
    Commented Jan 18, 2018 at 17:12

5 Answers 5

8
  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.

4
  • 1
    Content of /etc/default/atop: "# this file is no longer used and will be removed in a future release". Would you know where is the new file?
    – toliveira
    Commented Sep 2, 2020 at 23:48
  • 1
    According to atop manpage, it is now configurable using /etc/atoprc or ~/.atoprc. man atoprc list configuration options.
    – Darkfish
    Commented Sep 9, 2020 at 1:57
  • 1
    Update: atoprc doesn't control log interval of the background job that saves these logfiles. Instead it only controls the default for interactive session. So it seems like one has to edit the file /usr/share/atop/atop.daily or wherever an equivalent file is on a given system.
    – Darkfish
    Commented Sep 11, 2020 at 3:55
  • 1
    Thanks for noting the different config path for CentOS, you'd think they'd mention this in the man pages..
    – MSpreij
    Commented Jun 29, 2021 at 9:22
5

On Ubuntu 18.04 you'd change the file /usr/share/atop/atop.daily and change the line:

INTERVAL=600

to:

INTERVAL=60 
1
  • Ubuntu 20 the same, thank you Commented Aug 5, 2021 at 6:21
2

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

1
  • 1
    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" Commented Apr 5, 2019 at 15:35
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
4
  • but how to change the log path to /var/log/atop/foo.log ?
    – Raptor
    Commented Apr 13, 2016 at 6:18
  • 1
    @Raptor, do we need to? Find out with: ps -A atop && lsof -p $(pidof atop) | grep log
    – agc
    Commented Apr 13, 2016 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
    Commented May 16, 2019 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
    Commented May 16, 2019 at 12:07
0

you need to change the values as your need on the file /etc/sysconfig/atop

mainly

LOGOPTS=""
LOGINTERVAL=600
LOGGENERATIONS=28
LOGPATH=/var/log/atop
3
  • Welcome to U&L. Please note, you're answering to a 7y old question with an accepted answer. While providing new insight to old questions is perfectly fine, at this point the answer really needs to provide something essentially new. As far as I can see you're just re-hashing the 4 previous answers, so what exactly is the new thing you're bringing to the table? Commented Mar 21, 2023 at 13:42
  • Without digging too deep into the details, I notice that this new answer refer to LOGINTERVAL, while all older answers seem to be mentioning INTERVAL. It appears the variable was switched in commit 9628791. Maybe someone with deeper interest in atop could dig into that and clarify whether the rename is crucial or not?
    – sampi
    Commented Mar 24, 2023 at 15:15
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Mar 24, 2023 at 15:18

You must log in to answer this question.

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