Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1540132

Summary: [RFE]: Delay loading imjournal after opening omfile FDs
Product: Red Hat Enterprise Linux 7 Reporter: Renaud Métrich <rmetrich>
Component: rsyslogAssignee: Jiří Vymazal <jvymazal>
Status: CLOSED DUPLICATE QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: cww, jvymazal, rmetrich
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-07-23 08:44:21 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:

Description Renaud Métrich 2018-01-30 10:40:11 UTC
Description of problem:

When using default rsyslog and systemd parameters, rsyslog cannot open files /var/log/secure, /var/log/messages, etc for writing if a persistent journal is used and ~1000 files are listed in /var/log/journal/<machine_id>

The issue happens if there are a lot of users accessing the system, as default journald.conf "SplitMode=uid" or "SplitMode=login" is used.

If there was not many journal files at the time rsyslogd started, then, upon reaching the number of files limit, logs for newly connecting users will be lost.


Version-Release number of selected component (if applicable):

rsyslog-8.24.0-12.el7.x86_64


How reproducible:

Always


Steps to Reproduce:
1. Create persistent journal

  # mkdir -p /var/log/journal
  # systemctl restart systemd-journald

2. Create 2000 users

  # for i in $(seq 1 2000); do useradd user$i; passwd --stdin user$i <<< pass; done

3. Create the journal files for the users (e.g. connect to the system as the user using ssh)


Actual results:

Upon reaching 1024 files, new user's log in /var/log/secure is lost because rsyslogd doesn't process the user-XXX.journal file.

Upon restarting rsyslogd, no log goes into /var/log/messages or /var/log/secure:

# ll /proc/$(pgrep rsyslogd)/fd | grep -vw journal
total 0
lr-x------. 1 root root 64 Jan 30 11:28 0 -> /dev/null
l-wx------. 1 root root 64 Jan 30 11:28 1 -> /dev/null
l-wx------. 1 root root 64 Jan 30 11:28 2 -> /dev/null
lrwx------. 1 root root 64 Jan 30 11:28 3 -> socket:[794974]
lr-x------. 1 root root 64 Jan 30 11:28 4 -> anon_inode:inotify

Comment 6 Renaud Métrich 2018-03-01 13:50:23 UTC
The issue is not withing rsyslogd, but the systemd library rsyslogd is linking against (due to imjournal plugin).
The library opens all files in the /var/log/journal/<machineid> even though they will likely not be used later.
See BZ 1550575 for corresponding systemd issue.

At the rsyslog level, we may "fix" somehow the issue by delaying imjournal initialization until the internal FDs are opened, this would at least enable to have FDs to /var/log/{message,|secure,...}

Comment 8 Jiří Vymazal 2018-03-02 13:25:42 UTC
Ok, so I changed this to RFE as you described, that is to delay imjournal initialization after the "core" files are opened. 

Other option for the use case you described in initial comment is to do the file splitting in rsyslog using dynamic files.

Comment 9 Renaud Métrich 2018-03-09 11:01:47 UTC
See also BZ 1553700, maybe this RFE will not be needed after all.