Hide Forgot
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)
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
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.
Hello Tomas, Thanks for the input - do you have any skeleton wrapper-example that I could recommend to the customer as a possible workaround?
Not at this point. I'm not familiar with Tomcat.
Tested this with rsyslog v8 and not able to reproduce the tomcat issue anymore (catalina still logs after forced logrotate with above configuration options)
*** Bug 1376459 has been marked as a duplicate of this bug. ***
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