RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1061322 - systemd doesn't automatically restart rsyslog
Summary: systemd doesn't automatically restart rsyslog
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rsyslog
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Tomas Heinrich
QA Contact: Marek Marusic
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-04 15:56 UTC by Tomas Heinrich
Modified: 2015-11-19 14:29 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 799331
Environment:
Last Closed: 2015-11-19 14:29:34 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2173 0 normal SHIPPED_LIVE rsyslog bug fix update 2015-11-19 11:34:00 UTC

Description Tomas Heinrich 2014-02-04 15:56:18 UTC
+++ This bug was initially created as a clone of Bug #799331 +++

Description of problem:

Systemd does not automatically restart rsyslog if it exits, e.g. after restoring a crashed system with a sysrq key combination. Syslog is a critical service, and should therefore be restarted.


How reproducible:
Always


Steps to Reproduce:
1. kill $rsyslog_pid
2. systemctl status rsyslog.service

  
Actual results:
Syslog is and stays dead.


Expected results:
Systemd restarts syslog.


Additional info:
Fix by adding "Restart=always" to the "Service" section in /lib/systemd/system/rsyslog.service

--- Additional comment from Jóhann B. Guðmundsson on 2012-03-02 15:25:44 CET ---

Service should not be restarted automatically by default. 

By the way where did you get the bright idea from that this was a smart thing to do?

--- Additional comment from Jóhann B. Guðmundsson on 2012-03-02 15:30:06 CET ---

Anyway moving this against rsyslog in the end he's the one you have to convince that this is an great idea...

--- Additional comment from Michal Schmidt on 2012-03-02 16:04:54 CET ---

(In reply to comment #0)
> Syslog is a critical service, and should therefore be restarted.

It is not critical everywhere. It depends on the use case. It's a policy
decision. We provide the mechanism.

> Additional info:
> Fix by adding "Restart=always" to the "Service" section in
> /lib/systemd/system/rsyslog.service

Feel free to adjust the restart policy for any service you want on your system
(just do it by putting modified unit files under /etc/systemd/system,
http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F).

I do not think it would be a good idea to ship auto-restarting services by default.

--- Additional comment from Andreas Fleig on 2012-03-02 18:00:05 CET ---

Well, it's just what I expected to happen, since I noticed that gdm and mysqld are restarted automatically. I won't take offense if you close this issue as NOTABUG...

--- Additional comment from Jóhann B. Guðmundsson on 2012-03-02 18:11:23 CET ---

gdm is exeption to the general rule but mysql hmm must be because mysqld_safe did that. 

In any case administrators should put and arguably this is better default restart behaviour than default to none is to set Restart=on-failure

--- Additional comment from Florian Weimer on 2012-08-23 13:18:12 CEST ---

If the syslog daemon is gone, we lose a lot of system logging.  This makes post-mortem analysis really difficult, so I'd prefer if it was restarted automatically.

--- Additional comment from Fedora End Of Life on 2013-01-16 21:04:38 CET ---

This message is a reminder that Fedora 16 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 16. 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 WONTFIX if it remains open with a Fedora 
'version' of '16'.

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 prior to Fedora 16's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 16 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 to click on 
"Clone This Bug" and open it against that version of Fedora.

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.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

--- Additional comment from Florian Weimer on 2013-01-17 07:24:56 CET ---

Still present in rsyslog-7.2.4-1.fc18.x86_64.

--- Additional comment from Jóhann B. Guðmundsson on 2013-01-17 07:36:02 CET ---

If you want to restart rsyslog automatically you do so by following http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F

And add Restart=on-failure or Restart=Always to the resyslogd unit file

This is not a systemd bug thus closing

--- Additional comment from Florian Weimer on 2013-01-17 07:42:33 CET ---

(In reply to comment #9)
> This is not a systemd bug thus closing

This was filed against rsylog, so reopening.

--- Additional comment from Jóhann B. Guðmundsson on 2013-01-17 07:47:05 CET ---

Regardless of that it's not a bug. You just manually add this to your unit if you feel it necessary the rest of us can live with recovering logs from systemd journal.

--- Additional comment from Fedora End Of Life on 2013-12-21 09:33:49 CET ---

This message is a reminder that Fedora 18 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 18. 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 WONTFIX if it remains open with a Fedora 
'version' of '18'.

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 prior to Fedora 18's end of life.

Thank you for reporting this issue and we are sorry that we may not be 
able to fix it before Fedora 18 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 to Fedora 18's end of life.

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.

--- Additional comment from Tomas Heinrich on 2013-12-22 14:14:23 CET ---

Given that journald is the default now and this change can have adverse effects, I'd rather not turn auto-restarting on by default.

Comment 1 Tomas Heinrich 2014-02-04 16:07:51 UTC
I was asked to consider this change for RHEL, hence reopening.

I can only see automatic restart functionality useful in the case of a random crash (Restart=on-abort).
Even in that case, this can lead to destruction of the data required for analysis of the crash or cause a restart & crash loop. The later perhaps can be managed employing some of systemd's directives (StartLimitBurst=, StartLimitInterval=, ...).

So, is this behavior really desirable?

Comment 2 Florian Weimer 2014-02-04 16:20:33 UTC
(In reply to Tomas Heinrich from comment #1)

> So, is this behavior really desirable?

All I can say that it is really, really annoying when you're doing forensics and the syslog daemon was not running for extended periods of time because it was killed by the OOM killer or some other mishap.

Comment 4 Tomas Heinrich 2015-04-11 14:27:21 UTC
I guess the potential benefits outweigh the potential drawbacks.
Though this is a change in behavior, it shouldn't be an excessively big one for a .2 release.

Comment 8 Bryan Totty 2015-04-26 21:49:28 UTC
I see a lot of upside for adding the automatic ability for rsyslog to automatically restart. 

For example, why else are you running rsyslog unless you want to capture critical log messages? 

Sometimes things go bad and a service like rsyslog is unintentionally killed and this make the support process very difficult if no logging information is captured during that period. If you want to troubleshoot an issue and you have lost your logging during that period, then you essentially have nothing to go on. If you don't want logging, then don't enable the service to run on the system. If you do want logging, then it would seem that you wouldn't want a bug or some rogue process killing rsyslogd.

Although, we do have to consider any side effects of implementing a rsyslog auto-restart. For example, is there a potential for exploit of a auto-restarting service? Possibly. But, in the case that you are using a daemon like auditd, you might have a better change of catching malicious attempts for process execution or other unwanted behavior.

If this is implemented, it should be clearly stated in the man pages and easy to change if it is unwanted by a systems administrator. We could also look at setting a counter or some type of time interval in case of a repeated rsyslog crash. You wouldn't want rsyslog to crash and come back up hundreds or thousands of times on a production server.

Comment 11 Tomas Heinrich 2015-04-27 09:26:22 UTC
(In reply to Bryan Totty from comment #8)

Thank you Bryan.

We'll leverage systemd's auto-restart functionality, thus it's easy for us to turn it on and for anybody to change it. systemd, by default, also prevents an excessive number of restarts to happen in a short time.

Comment 12 Susant Sahani 2015-04-28 14:32:24 UTC
(In reply to Bryan Totty from comment #8)
> I see a lot of upside for adding the automatic ability for rsyslog to
> automatically restart. 
> 
> For example, why else are you running rsyslog unless you want to capture
> critical log messages? 
> 
> Sometimes things go bad and a service like rsyslog is unintentionally killed
> and this make the support process very difficult if no logging information
> is captured during that period. If you want to troubleshoot an issue and you
> have lost your logging during that period, then you essentially have nothing
> to go on. If you don't want logging, then don't enable the service to run on
> the system. If you do want logging, then it would seem that you wouldn't
> want a bug or some rogue process killing rsyslogd.

Unless journald is configured as volatile, no logs will be missed if journald
is configured as persistent. rsyslog just pull the data from the journal. Logs are always available with journal if configured to be persistent.

Comment 13 Tomas Heinrich 2015-04-28 14:59:32 UTC
(In reply to Susant Sahani from comment #12)
> Unless journald is configured as volatile, no logs will be missed if journald
> is configured as persistent. rsyslog just pull the data from the journal.
> Logs are always available with journal if configured to be persistent.

In el7, the storage for journald defaults to 'auto'. Since /var/log/journal doesn't exist by default, the storage is effectively 'volatile'.

Comment 16 errata-xmlrpc 2015-11-19 14:29:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2173.html


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