Bug 1820069 - freshclam's logrotate settings incorrect because daemon is not restarted/nofitifed
Summary: freshclam's logrotate settings incorrect because daemon is not restarted/nofi...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: clamav
Version: rawhide
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Sergio Basto
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-02 08:10 UTC by Trevor Cordes
Modified: 2020-05-30 01:43 UTC (History)
11 users (show)

Fixed In Version: clamav-0.102.3-1.fc32 clamav-0.102.3-1.fc31 clamav-0.102.3-1.fc30 clamav-0.102.3-1.el8 clamav-0.102.3-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-23 02:43:56 UTC
Type: Bug


Attachments (Terms of Use)

Description Trevor Cordes 2020-04-02 08:10:36 UTC
Description of problem:
The log rotation of freshclam's log is incorrect.  Logrotate rotates the file but freshclam keeps writing to the old (now rotated and renamed) file.

-rw-rw-r-- 1 root clamupdate      0 Apr  1 00:00 /var/log/freshclam.log
-rw-rw-r-- 1 root clamupdate 123116 Apr  2 02:51 /var/log/freshclam.log-20200401

The logrotate setup:

#cat logrotate.d/clamav-update
/var/log/freshclam.log {
        monthly
        notifempty
        missingok
}

Used to work fine for the previous way freshclam worked, but now it obviously needs to notify the daemon or restart it in order for the daemon to use the newly logrotate-created log file.


Version-Release number of selected component (if applicable):
clamav-update-0.102.2-3.fc30.x86_64


How reproducible:
always; many machines


Steps to Reproduce:
1. install clamav and clamav-update
2. wait until the rotation should occur
3. watch freshclam continue to write to the old file

Actual results:
writes to the old, renamed file


Expected results:
should write to the newly created empty file

Comment 1 Sergio Basto 2020-04-03 04:19:34 UTC
we changed clamav-update , On dnf update you should can read this message [1] Please run 'systemctl enable clamav-freshclam --now'


[1]
Warning: clamav-update package changed
Now we provide clamav-freshclam.service systemd unit instead old scripts and the cron.d entry.
Unfortunately this may break existing unattended installations.
Please run 'systemctl enable clamav-freshclam --now' to enable freshclam updates again.

Comment 2 Trevor Cordes 2020-04-03 05:40:09 UTC
You misunderstand.  I've already done:
systemctl enable clamav-freshclam --now

Freshclam is running just fine for week under systemd.  That's the not the problem.  The problem is the logrotate script has not been updated to reflect the newer behavior of freshclam.

#rpm -ql clamav-update |grep rotat
/etc/logrotate.d/clamav-update

Note especially the dates of the two /var/log/freshclam.log* files I listed above.  The mtime on the rotated file is later than the date the rotated file is named for!  And it's still at this very moment being written to by my freshclam, whilst the new /var/log/freshclam.log file is 0 bytes.

Comment 3 Sergio Basto 2020-04-03 06:01:54 UTC
ok , thanks for the quick reply   we need a `systemctl try-restart  clamav-freshclam.service`  after rotate or we should remove /etc/logrotate.d/clamav-update , because now you have the logs in journalctl -u clamav-freshclam

Comment 4 Sergio Basto 2020-04-03 06:04:15 UTC
and we may comment UpdateLogFile [1] on /etc/freshclam.conf as is default 


[1] 
 #UpdateLogFile /var/log/freshclam.log

Comment 5 Trevor Cordes 2020-04-03 06:11:24 UTC
I use rsyslog for freshclam, as I'm sure many do, so keeping the logrotate rule makes sense (as with other daemons).  Looks like your additional line idea is all that is needed.  It doesn't look like freshclam has any other way to kick it to reopen the log.  Thanks!

Comment 6 Sergio Basto 2020-04-09 02:35:41 UTC
I propose https://src.fedoraproject.org/rpms/clamav/pull-request/12

Comment 7 Trevor Cordes 2020-04-09 03:22:54 UTC
Looks good, but to be more like most of the other daemon out there (I checked their logrotate files), how about beefing it up to:

/usr/bin/systemctl try-restart clamav-freshclam.service > /dev/null 2>&1 || true

Not sure if the full path, the redirects, or the true bit are really important in the case of freshclam, but that's what most daemons are using.  Thanks!

Comment 8 Ben Cotton 2020-04-30 20:12:50 UTC
This message is a reminder that Fedora 30 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 30 on 2020-05-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '30'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 30 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 9 Fedora Update System 2020-05-07 04:34:39 UTC
FEDORA-2020-449ef64b54 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-449ef64b54

Comment 10 Fedora Update System 2020-05-07 04:35:14 UTC
FEDORA-2020-dcb7a1f57b has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2020-dcb7a1f57b

Comment 11 Fedora Update System 2020-05-07 04:35:33 UTC
FEDORA-2020-6ffef7e6a4 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2020-6ffef7e6a4

Comment 12 Fedora Update System 2020-05-08 04:09:40 UTC
FEDORA-2020-449ef64b54 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-449ef64b54`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-449ef64b54

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

Comment 13 Fedora Update System 2020-05-08 04:52:23 UTC
FEDORA-2020-6ffef7e6a4 has been pushed to the Fedora 30 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-6ffef7e6a4`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-6ffef7e6a4

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

Comment 14 Fedora Update System 2020-05-08 05:08:48 UTC
FEDORA-2020-dcb7a1f57b has been pushed to the Fedora 31 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-dcb7a1f57b`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-dcb7a1f57b

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

Comment 15 Fedora Update System 2020-05-08 12:37:13 UTC
FEDORA-EPEL-2020-6d1d2497d0 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2020-6d1d2497d0

Comment 16 Fedora Update System 2020-05-08 12:37:39 UTC
FEDORA-EPEL-2020-2692293800 has been submitted as an update to Fedora EPEL 8. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2020-2692293800

Comment 17 Fedora Update System 2020-05-09 03:30:17 UTC
FEDORA-EPEL-2020-2692293800 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-2020-2692293800

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

Comment 18 Fedora Update System 2020-05-09 04:16:28 UTC
FEDORA-EPEL-2020-6d1d2497d0 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-2020-6d1d2497d0

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

Comment 19 Fedora Update System 2020-05-15 04:31:05 UTC
FEDORA-2020-bca44487a1 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-bca44487a1`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-bca44487a1

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

Comment 20 Fedora Update System 2020-05-15 04:41:33 UTC
FEDORA-EPEL-2020-765ceaa306 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-2020-765ceaa306

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

Comment 21 Fedora Update System 2020-05-15 04:44:38 UTC
FEDORA-EPEL-2020-235a51a239 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-2020-235a51a239

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

Comment 22 Fedora Update System 2020-05-15 05:09:56 UTC
FEDORA-2020-b0acd7b66e has been pushed to the Fedora 31 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-b0acd7b66e`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-b0acd7b66e

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

Comment 23 Fedora Update System 2020-05-15 05:47:15 UTC
FEDORA-2020-d98d2cbae1 has been pushed to the Fedora 30 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-d98d2cbae1`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-d98d2cbae1

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

Comment 24 Fedora Update System 2020-05-23 02:43:56 UTC
FEDORA-2020-bca44487a1 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 25 Fedora Update System 2020-05-23 02:50:44 UTC
FEDORA-2020-b0acd7b66e has been pushed to the Fedora 31 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 26 Fedora Update System 2020-05-23 03:21:54 UTC
FEDORA-2020-d98d2cbae1 has been pushed to the Fedora 30 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 27 Fedora Update System 2020-05-30 00:40:43 UTC
FEDORA-EPEL-2020-765ceaa306 has been pushed to the Fedora EPEL 8 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 28 Fedora Update System 2020-05-30 01:43:55 UTC
FEDORA-EPEL-2020-235a51a239 has been pushed to the Fedora EPEL 7 stable repository.
If problem still persists, please make note of it in this bug report.


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