Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 658842 - app-admin/rsyslog: logrotate postrotate script fails when rsyslog is run as a systemd service
Summary: app-admin/rsyslog: logrotate postrotate script fails when rsyslog is run as a...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal minor
Assignee: Thomas Deutschmann (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-23 16:12 UTC by Vladimir Vrzić
Modified: 2018-07-14 13:52 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info from affected Gentoo/systemd machine (emerge-info,6.21 KB, text/plain)
2018-06-23 16:12 UTC, Vladimir Vrzić
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Vrzić 2018-06-23 16:12:29 UTC
Created attachment 536970 [details]
emerge --info from affected Gentoo/systemd machine

app-admin/rsyslog/files/8-stable/rsyslog.logrotate is not compatible with systemd -- it uses the following postrotate script

test -r /run/rsyslogd.pid && kill -HUP $(cat /run/rsyslogd.pid) &>/dev/null

to tell rsyslogd to close open file descriptors after log rotation.

On the other hand, /lib/systemd/system/rsyslog.service (packaged upstream) starts rsyslogd with

ExecStart=/usr/sbin/rsyslogd -n -iNONE

Because of -iNONE argument, /run/rsyslogd.pid never gets created, and postrotate script that relies on this file being present will always fail.

Solution: on systems running systemd, install the following logrotate postrotate script:

postrotate
  systemctl kill -s HUP rsyslog.service
endscript

Related discussion from upstream issue tracker:

https://github.com/rsyslog/rsyslog/issues/2143
Comment 1 Larry the Git Cow gentoo-dev 2018-07-14 13:52:26 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4e136ce392501839c48f8ccfd7738f3afe6d8fec

commit 4e136ce392501839c48f8ccfd7738f3afe6d8fec
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2018-07-14 13:51:52 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2018-07-14 13:52:13 +0000

    app-admin/rsyslog: fix logrotate for systemd users
    
    Closes: https://bugs.gentoo.org/658842
    Package-Manager: Portage-2.3.42, Repoman-2.3.9
    RepoMan-Options: --force

 .../rsyslog/files/8-stable/rsyslog-r1.logrotate    | 45 ++++++++++++++++++++++
 ...slog-8.35.0.ebuild => rsyslog-8.35.0-r1.ebuild} |  2 +-
 ...slog-8.36.0.ebuild => rsyslog-8.36.0-r1.ebuild} |  2 +-
 3 files changed, 47 insertions(+), 2 deletions(-)