Bug 1945494 - atop logging doesn't work
Summary: atop logging doesn't work
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: atop
Version: epel7
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Gwyn Ciesla
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-04-01 06:19 UTC by l.calamai.guest
Modified: 2021-05-07 15:45 UTC (History)
1 user (show)

Fixed In Version: atop-2.6.0-6.fc33 atop-2.6.0-6.fc32 atop-2.6.0-6.fc34 atop-2.6.0-6.el8 atop-2.6.0-6.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-04-21 21:41:11 UTC
Type: Bug


Attachments (Terms of Use)

Description l.calamai.guest 2021-04-01 06:19:16 UTC
Description of problem:
after updating to the last package version atop service do not log correctly, old files are not deleted after X days as stated in atop.daily, and logging itself randomly stop writing log files, even if atop still continue to write in the cache file.

Version-Release number of selected component (if applicable):
atop-2.6.0-3.el7

How reproducible:
install atop, configure /usr/share/atop/atop.daily , enable and start the related service, observe files in /var/log/atop .

Steps to Reproduce:
1. yum install atop
2. sed -i 's/600/60/' /etc/sysconfig/atop
3. sed -i 's/600/60/' /usr/share/atop/atop.daily
4. sed -i 's/28/7/' /usr/share/atop/atop.daily
5. systemctl start atop
6. systemctl enable atop
7. ls -lh /var/log/atop
8. ls -lh /var/cache/atop

Actual results:
New log files are not written/created
Old log files are not deleted

Expected results:
New log files are written/created
Old log files are deleted

Additional info:

Comment 1 Gwyn Ciesla 2021-04-01 13:12:55 UTC
Version 2.6.0-5 in updates-testing corrects this issue.

Comment 2 l.calamai.guest 2021-04-08 06:01:33 UTC
I am sorry, but the issue still exists after upgrading to the package version 2.6.0-5 in updates-testing.

Comment 3 Gwyn Ciesla 2021-04-08 13:17:09 UTC
Did you replace /etc/sysconfig/atop with the newly-created /etc/sysconfig/atop.rpmnew?

Comment 4 l.calamai.guest 2021-04-08 13:28:53 UTC
here is my /etc/sysconfig/atop :
# sysconfig atop
#

# Current Day format
CURDAY=`date +%Y%m%d`
# Log files path
LOGPATH=/var/log/atop
# Binaries path
BINPATH=/usr/bin
# PID File
PIDFILE=/var/run/atop.pid
# interval (default 10 minutes)
LOGINTERVAL=60

LOGOPTS=""
LOGGENERATIONS=7

I added the last two lines from the new file to the previous file.

I also noticed that the file /var/log/atop/daily.log keep the creation date instead of changing every day as in atop old rpm version.

This issue apply in x86_64 from precompiled rpm and in s390x compiled from source rpm.

Comment 5 Gwyn Ciesla 2021-04-08 13:35:18 UTC
Replace the old file with the new file, completely.

Comment 6 l.calamai.guest 2021-04-08 13:44:54 UTC
I replaced the file, now /etc/sysconfig/atop contains :
LOGOPTS=""
LOGINTERVAL=60
LOGGENERATIONS=7
LOGPATH=/var/log/atop

as I restarted the service (systemctl restart atop) it was deleted an old log file, but still the file /var/log/atop/daily.log do not update
 his date.
I will update you tomorrow about the log rotation.

Comment 7 l.calamai.guest 2021-04-09 06:53:07 UTC
[root@xxxxxxxx ~]# ls -lh /var/log/atop
total 116M
-rw-r--r--. 1 root root 6.5M Apr  1 00:00 atop_20210331
-rw-r--r--. 1 root root  13M Apr  2 00:00 atop_20210401
-rw-r--r--. 1 root root  13M Apr  3 00:00 atop_20210402
-rw-r--r--. 1 root root  13M Apr  4 00:00 atop_20210403
-rw-r--r--. 1 root root  13M Apr  5 00:00 atop_20210404
-rw-r--r--. 1 root root  12M Apr  6 00:00 atop_20210405
-rw-r--r--. 1 root root  31M Apr  8 07:58 atop_20210406
-rw-r--r--. 1 root root  14M Apr  9 08:41 atop_20210408
-rw-r--r--. 1 root root    0 Apr  6 00:00 daily.log
[root@xxxxxxxx ~]# systemctl status atop
● atop.service - Atop advanced performance monitor
   Loaded: loaded (/usr/lib/systemd/system/atop.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2021-04-08 15:39:29 CEST; 17h ago
     Docs: man:atop(1)
  Process: 29348 ExecStartPost=/usr/bin/find ${LOGPATH} -name atop_* -mtime +${LOGGENERATIONS} -exec rm -v {} ; (code=exited, status=0/SUCCESS)
  Process: 29343 ExecStartPre=/bin/sh -c test -n "$LOGGENERATIONS" -a "$LOGGENERATIONS" -eq "$LOGGENERATIONS" (code=exited, status=0/SUCCESS)
  Process: 29341 ExecStartPre=/bin/sh -c test -n "$LOGINTERVAL" -a "$LOGINTERVAL" -eq "$LOGINTERVAL" (code=exited, status=0/SUCCESS)
 Main PID: 29347 (atop)
    Tasks: 1
   Memory: 13.9M
   CGroup: /system.slice/atop.service
           └─29347 /usr/bin/atop -w /var/log/atop/atop_20210408 60

Apr 08 15:39:29 xxxxxxxx systemd[1]: Starting Atop advanced performance monitor...
Apr 08 15:39:29 xxxxxxxx find[29348]: removed ‘/var/log/atop/atop_20210319’
Apr 08 15:39:29 xxxxxxxx systemd[1]: Started Atop advanced performance monitor.

[root@xxxxxxxx ~]# find /var/log/atop -name atop_* -mtime +7
/var/log/atop/atop_20210331

[root@x0svdsa1 ~]# cat /etc/sysconfig/atop
LOGOPTS=""
LOGINTERVAL=60
LOGGENERATIONS=7
LOGPATH=/var/log/atop

It still doesn't delete old logs, I mean older than LOGGENERATIONS value.

Comment 8 Gwyn Ciesla 2021-04-09 21:52:52 UTC
Is the automated daily restart working?

Comment 9 l.calamai.guest 2021-04-12 05:24:51 UTC
How could I check if automated daily restart is working?

Comment 10 l.calamai.guest 2021-04-12 06:53:12 UTC
By the way, on the same machines if I remove the new package and I install the old package there is no issue anymore, so the issue should be in the new rpm package IMHO.

It seems to me that atop service start well then after some time it does not work well anymore.

Comment 11 Fedora Update System 2021-04-13 13:42:45 UTC
FEDORA-2021-9f7491e4a7 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-9f7491e4a7

Comment 12 Fedora Update System 2021-04-13 13:42:46 UTC
FEDORA-2021-db5b54a405 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-db5b54a405

Comment 13 Fedora Update System 2021-04-13 13:42:47 UTC
FEDORA-2021-01bf42fd5c has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2021-01bf42fd5c

Comment 14 Fedora Update System 2021-04-13 20:48:00 UTC
FEDORA-2021-db5b54a405 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-db5b54a405`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-db5b54a405

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 15 Fedora Update System 2021-04-14 15:14:26 UTC
FEDORA-2021-9f7491e4a7 has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-9f7491e4a7`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-9f7491e4a7

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 16 l.calamai.guest 2021-04-14 15:21:02 UTC
I do not use Fedora, I installed atop rpm package from EPEL repository inside RHEL7 and RHEL8.
I will not add Fedora repositories to RHEL machines.

Comment 17 Gwyn Ciesla 2021-04-14 15:22:44 UTC
This bug is referenced by updates to both EPEL and Fedora, you may ignore the Fedora comments.

Comment 18 Fedora Update System 2021-04-14 15:23:53 UTC
FEDORA-EPEL-2021-667b444f64 has been pushed to the Fedora EPEL 8 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2021-667b444f64

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 19 Fedora Update System 2021-04-14 15:26:54 UTC
FEDORA-EPEL-2021-76dc640120 has been pushed to the Fedora EPEL 7 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2021-76dc640120

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 20 Fedora Update System 2021-04-14 15:35:07 UTC
FEDORA-2021-01bf42fd5c has been pushed to the Fedora 32 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-01bf42fd5c`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-01bf42fd5c

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 21 Fedora Update System 2021-04-21 21:41:11 UTC
FEDORA-2021-9f7491e4a7 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 22 Fedora Update System 2021-04-21 21:48:44 UTC
FEDORA-2021-01bf42fd5c has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 23 Fedora Update System 2021-04-24 20:11:20 UTC
FEDORA-2021-db5b54a405 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 24 Fedora Update System 2021-04-29 01:17:39 UTC
FEDORA-EPEL-2021-667b444f64 has been pushed to the Fedora EPEL 8 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 25 Fedora Update System 2021-04-29 01:36:39 UTC
FEDORA-EPEL-2021-76dc640120 has been pushed to the Fedora EPEL 7 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 26 l.calamai.guest 2021-04-30 05:40:32 UTC
The same issue still persists after the upgrade to the latest version (atop-2.6.0-6.el8 atop-2.6.0-6.el7):
the atop logs don't rotate.

Comment 27 Gwyn Ciesla 2021-04-30 13:45:39 UTC
And this is with the replaced /etc/sysconfig/atop? And after sudo systemctl daemon-reload and sudo systemctl restart atop?

Comment 28 l.calamai.guest 2021-05-06 14:01:28 UTC
Yes, I confirm that I replaced /etc/sysconfig/atop , systemctl daemon-reload and systemctl restart atop , the atop log rotate only during "systemctl restart atop" but do not rotate every night at midnight like it should do.

Comment 29 Gwyn Ciesla 2021-05-06 14:18:43 UTC
Interesting. How often does it rotate, and what's in your /etc/sysconfig/atop?

Comment 30 l.calamai.guest 2021-05-06 14:33:51 UTC
Here is the content of /etc/sysconfig/atop

[root@x0svdsa1 ~]# cat /etc/sysconfig/atop
LOGOPTS=""
LOGINTERVAL=60
LOGGENERATIONS=7
LOGPATH=/var/log/atop
[root@x0svdsa1 ~]# ls -lh /var/log/atop
total 265M
-rw-r--r--. 1 root root 161M Apr 29 16:00 atop_20210416
-rw-r--r--. 1 root root 8.7M Apr 30 09:20 atop_20210429
-rw-r--r--. 1 root root  50M May  4 07:26 atop_20210430
-rw-r--r--. 1 root root  30M May  6 16:29 atop_20210504
-rw-r--r--. 1 root root    0 Apr  6 00:00 daily.log
[root@x0svdsa1 ~]#

it rotates only after "systemctl restart atop" and only if the last log file is from a previous day.
In previous version of the atop rpm package it rotates correctly every night at midnight.

Comment 31 Gwyn Ciesla 2021-05-06 15:00:43 UTC
Is the timer enabled? sudo systemctl status atop-rotate.timer
If not, sudo systemctl enable atop-rotate.timer

Comment 32 l.calamai.guest 2021-05-06 15:38:58 UTC
I did as you suggested:

[root@x0svdsa1 ~]# systemctl status atop-rotate.timer
● atop-rotate.timer - Daily atop restart
   Loaded: loaded (/usr/lib/systemd/system/atop-rotate.timer; disabled; vendor preset: disabled)
   Active: inactive (dead)
[root@x0svdsa1 ~]# systemctl enable --now atop-rotate.timer
Created symlink from /etc/systemd/system/timers.target.wants/atop-rotate.timer to /usr/lib/systemd/system/atop-rotate.timer.
[root@x0svdsa1 ~]# systemctl status atop-rotate.timer
● atop-rotate.timer - Daily atop restart
   Loaded: loaded (/usr/lib/systemd/system/atop-rotate.timer; enabled; vendor preset: disabled)
   Active: active (waiting) since Thu 2021-05-06 17:31:41 CEST; 7s ago

May 06 17:31:41 x0svdsa1 systemd[1]: Started Daily atop restart.
[root@x0svdsa1 ~]#

I was not aware of this change in the new rpm package, atop rpm package version 2.4.0-4.el7 did not provided this timer:

[root@x0cecdc1 ~]# systemctl status atop-rotate.timer
Unit atop-rotate.timer could not be found.
[root@x0cecdc1 ~]# systemctl status atop
● atop.service - Atop advanced performance monitor
   Loaded: loaded (/usr/lib/systemd/system/atop.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2021-05-06 00:00:02 CEST; 17h ago
     Docs: man:atop(1)
 Main PID: 20711 (atop)
    Tasks: 1
   Memory: 44.6M
   CGroup: /system.slice/atop.service
           └─20711 /usr/bin/atop -w /var/log/atop/atop_20210506 60

May 06 00:00:02 x0cecdc1 systemd[1]: Started Atop advanced performance monitor.
[root@x0cecdc1 ~]# rpm -qa | grep atop
atop-2.4.0-4.el7_9.s390x
[root@x0cecdc1 ~]#

I will verify tomorrow and I will report back.
Thank you very much.

Comment 33 Gwyn Ciesla 2021-05-06 15:42:52 UTC
You're very welcome, and good luck!

Comment 34 l.calamai.guest 2021-05-07 05:32:03 UTC
Atop logs rotates correctly now.

Comment 35 Gwyn Ciesla 2021-05-07 15:45:30 UTC
Excellent!


Note You need to log in before you can comment on or make changes to this bug.