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 1133687 - File Input Module(imfile) does not continue logging when service is logrotated with the 'copytruncate' option
Summary: File Input Module(imfile) does not continue logging when service is logrotate...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rsyslog
Version: 7.2
Hardware: All
OS: All
high
high
Target Milestone: rc
: 7.4
Assignee: Jiří Vymazal
QA Contact: Stefan Dordevic
Vladimír Slávik
URL:
Whiteboard:
: 1376459 (view as bug list)
Depends On: rsyslog-rhel74-rebase
Blocks: 1298243 1377248
TreeView+ depends on / blocked
 
Reported: 2014-08-25 20:08 UTC by jstephen
Modified: 2023-09-28 04:03 UTC (History)
15 users (show)

Fixed In Version: rsyslog-8.24.0-6.el7
Doc Type: Known Issue
Doc Text:
Some log messages are lost when the *logrotate* "copytruncate" option is used with the *rsyslog* *imfile* module When the *logrotate* utility with "copytruncate" option is rotating a log file, the *imfile* module of the *rsyslog* utility might not have read all of the log messages from the file being rotated. As a consequence, these log messages are lost. To work around this problem, do not use the "copytruncate" log rotation option. Alternatively, it is possible to lower the probability of message loss by using the experimental option "reopenOnTruncate=on".
Clone Of:
Environment:
Last Closed: 2017-08-01 09:53:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 2619341 0 None None None 2017-07-10 13:41:08 UTC
Red Hat Knowledge Base (Solution) 2770111 0 None None None 2017-07-10 13:41:08 UTC
Red Hat Product Errata RHBA-2017:2306 0 normal SHIPPED_LIVE rsyslog bug fix and enhancement update 2017-08-01 12:41:59 UTC

Internal Links: 1649250

Description jstephen 2014-08-25 20:08:10 UTC
Description of problem:
Using the rsyslog File Input module with tomcat6's catalina.out file, it stops logging to syslog when catalina.out logrotate occurs.

/var/log/tomcat6/catalina.out {
    copytruncate
    weekly
    rotate 52
    compress
    missingok
    create 0644 tomcat tomcat
}

** rsyslog **

$ModLoad imfile

# catalina.out
$InputFileName /var/log/tomcat6/catalina.out
$InputFileTag catalina-out
$InputFileStateFile stat-catalina-out
$InputFileSeverity info
$InputFilePersistStateInterval 20000
$InputRunFileMonitor

Version-Release number of selected component (if applicable):
rsyslog-5.8.10-8.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Install tomcat6 package
2. Configure rsyslog to use the File Input module on /var/log/tomcat6/catalina.out
3. Force a logrotate

Actual results:
File input module stops working

Expected results:
File input module should continue logging to syslog

Additional info:
When logrotate occurs on most services/daemons, a reload(or SIGHUP) is sent to the process which causes it to release an association(or "connection") with the current log file and open a new file descriptor to the newly created log file. This is how logrotate works without issues for rsyslog, cron, etc.

File input module was tested with logrotate and works for httpd(which does not use copytruncate)

Comment 2 Tomas Heinrich 2014-09-02 14:49:23 UTC
Actually, this is a known issue[0].

The v5 and (since el6.6) v7 versions don't support rotation of monitored files.

This functionality was added upstream "recently", but only to the v8 branch. It _might_ be possible to backport it, but that would need more research.

[0] http://lists.adiscon.net/pipermail/rsyslog/2013-June/033068.html

Comment 4 Tomas Heinrich 2014-09-18 09:51:49 UTC
Looks like the issue is with the 'copytruncate' option to logrotate. In the v5 version, the imfile plugin should support proper file rotation (renaming the current file and proceeding to write to a new one with the original name).
I'm not familiar with Tomcat, but, theoretically, it should be possible to modify it (or write a script) to either do a proper rotation, or, instead of writing to catalina.out, pipe the logs to logger(1) or somesuch, or utilize some other input plugin other than imfile.

Comment 5 jstephen 2014-12-10 17:04:06 UTC
Hello Tomas,

Thanks for the input - do you have any skeleton wrapper-example that I could recommend to the customer as a possible workaround?

Comment 6 Tomas Heinrich 2014-12-11 12:27:09 UTC
Not at this point. I'm not familiar with Tomcat.

Comment 24 Jiří Vymazal 2017-01-03 10:52:50 UTC
Tested this with rsyslog v8 and not able to reproduce the tomcat issue anymore (catalina still logs after forced logrotate with above configuration options)

Comment 36 Assaf Muller 2017-07-10 13:41:08 UTC
*** Bug 1376459 has been marked as a duplicate of this bug. ***

Comment 41 errata-xmlrpc 2017-08-01 09:53:51 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://access.redhat.com/errata/RHBA-2017:2306


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