Bug 1245194
Summary: | imjournal: fscanf on state file `/var/lib/rsyslog/imjournal.state' failed | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Robert Scheck <redhat-bugzilla> | ||||
Component: | rsyslog | Assignee: | Peter Vrabec <pvrabec> | ||||
Status: | CLOSED ERRATA | QA Contact: | Stefan Dordevic <sdordevi> | ||||
Severity: | high | Docs Contact: | |||||
Priority: | high | ||||||
Version: | 7.1 | CC: | cww, gayleard, gnaik, hartsjc, ksrot, mdshaikh, pablo.iranzo, popolon72, pvrabec, robert.scheck, rsroka | ||||
Target Milestone: | rc | Keywords: | Patch | ||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2016-11-04 05:36:29 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Bug Depends On: | |||||||
Bug Blocks: | 1203710, 1295396, 1296594, 1313485 | ||||||
Attachments: |
|
Description
Robert Scheck
2015-07-21 12:46:09 UTC
Cross-filed case 01479984 on Red Hat customer portal. I'm getting this message on my Fedora-23beta/KDE laptop, when I restart rsyslog in order to get information in /var/log/messages . Created attachment 1170158 [details]
Patch that resolves reading and writing of statefile
This bug is caused by not very atomic writing of imjournal statefile and it's hardly reproducible but there is a way.
fscanf error appears only when rsyslog reads empty statefile and it will cause that imjournal is stopped so no logging from journal is performed.
When statefile contains some random bytes error appears again but from journal and imjournal is stopped too.
In this patch Rsyslog is writing imjournal statefile more atomically and secure.
Reading of statefile is more robust and it doesn't affect imjournal module so when corrupted statefile is read then imjournal ignore statefile and continue with logging and it doesn't stop. We can use a logger as a test if it's logging or not.
Patch introduce new option in both old and new config "IgnoreNonValidStateFile" which is default "on" and it can turn off ignorance of non valid statefile.
New config:
module(load="imjournal"
StateFile="imjournal.state"
IgnoreNonValidStatefile="on"/"off" #default on
#IgnorePreviousMessages="on"
)
Old config:
$ModLoad imjournal
$WorkDirectory /var/lib/rsyslog
$IMJournalStateFile imjournal.state
$IMJournalIgnoreNonValidStatefile on/off
#$IMJournalIgnorePreviousMessages on
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/RHEA-2016-2401.html Is this change going to be put to upstream to github.com rsyslog repository? Yes I hope so, Most likely in near future. We are already created a pull request on upstream github repository. https://github.com/rsyslog/rsyslog/pull/1317 |