-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auditd logrotation and imfile module cause lots of imfile-state files #89
Comments
FWIW, I've noticed that imfile state files have been accumulating on some Ubuntu boxes of ours in the same
|
This may be related to: rsyslog/rsyslog#4186 I'm running into this as well. A slew of versions but using Ubuntu: No state file surprisingly but behaving as it should: State file behaving as it should:
Problem started:
I have debug output if desired. Current for 8.2112.0 but if it would help for another version, let me know and I can do that for you. This became an issue as we use rsyslog to process and send auditd (i.e. linux-audit) logs. Some of our servers have a lot of activity and this caused us to run out of inodes. Very rare overall but a thing I'm sure many Linux admins do. There used to be an rsyslog wiki page which showed how to use rsyslog for auditd logging. That's pretty much our setup. I don't have that link anymore but it's probably going to be similar to this. We use UDP but pretty much the same setup. https://linux-audit.com/central-audit-logging-configuration-collecting-linux-audit-events/ |
I have noticed that the https://github.com/rsyslog/rsyslog/blob/master/plugins/imfile/imfile.c#L1063 In the
However
Here via I found this to be similar - updated a month ago - trying to see if this will work: rsyslog/rsyslog#5258 |
The fix used in #5258 did not work for me. Stale files are still left and the unlink call is not given the right argument. |
Hi,
I'm using rhel 7.6 and running rsyslogd 8.24.0-52.el7 and audit-2.8.4-4.el7. Every time the audit daemon rotates it logs (internal to auditd not logrotate configuration) we get imfile-state files that remain on the file system indefinitely and I suspect are losing any messages that are still to be sent from the rotated audit log. Here is an example of this happening:-
[root@testing:/var/spool/rsyslog]#ls -ltr /var/spool/rsyslog/imfile-state:1* |tail -4
-rw-------. 1 root root 112 Oct 28 11:28 /var/spool/rsyslog/imfile-state:18:4369a2957393e7b1
-rw-------. 1 root root 112 Oct 28 11:31 /var/spool/rsyslog/imfile-state:19:ae91f8feb5b52fa5
-rw-------. 1 root root 100 Oct 28 11:34 /var/spool/rsyslog/imfile-state:13:ea1ccbfb3c71e85d
-rw-------. 1 root root 112 Oct 28 11:34 /var/spool/rsyslog/imfile-state:12:2edd93420c1c7d70
[root@testing:/var/spool/rsyslog]#ls -ltr /var/log/audit/ |tail -5
-r--------. 1 root root 104857836 Oct 28 11:25 audit.log.4
-r--------. 1 root root 104857634 Oct 28 11:28 audit.log.3
-r--------. 1 root root 104857626 Oct 28 11:31 audit.log.2
-r--------. 1 root root 104857696 Oct 28 11:34 audit.log.1
-rw-------. 1 root root 92821855 Oct 28 11:37 audit.log
I've read some similar bugs like
https://bugzilla.redhat.com/show_bug.cgi?id=1763746
https://bugzilla.redhat.com/show_bug.cgi?id=1744682
Originally I was using the legacy way of doing this with an audit.conf in rsyslog.d as follows..
$ModLoad imfile
$InputFileName /var/log/audit/audit.log
$InputFileTag audispd:
$InputFileStateFile audit_log
$InputFileSeverity info
$InputFileFacility local6
$InputRunFileMonitor
$WorkDirectory /var/spool/rsyslog # default location for work (spool) files
But having read some other bugs and docs I've tried to move to the following configuration..
audit logs to arcsight
module(load="imfile" mode="inotify")
input(type="imfile"
File="/var/log/audit/audit.log"
Tag="audispd:"
Severity="info"
Facility="local6"
deleteStateOnFileDelete="on")
But no luck.. Whatever I've tried I always get the same imfile-states in the rsyslog working directory. On some of our busy audit systems the log files rotate every few minutes and we end up with tens of thousands of state files.
I do not see this issue on our rhel7.3 boxes that run rsyslogd 7.4.7 and have the legacy "$ModLoad imfile" configuration mentioned above.
Hopefully there is enough information to get this investigated but if there is anything else I need to provide please let me know.
Regards
The text was updated successfully, but these errors were encountered: