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 1520373 - Systemd does not start the log pipe from environment file
Summary: Systemd does not start the log pipe from environment file
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: 389-ds-base
Version: 9.1
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: 9.3
Assignee: LDAP Maintainers
QA Contact: LDAP QA Team
URL:
Whiteboard: sync-to-jira
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-12-04 11:25 UTC by Marc Muehlfeld
Modified: 2023-08-21 16:26 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-08-21 16:26:32 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Documentation from the RHDS Admin Guide (3.38 MB, application/pdf)
2017-12-04 12:06 UTC, Marc Muehlfeld
no flags Details

Description Marc Muehlfeld 2017-12-04 11:25:15 UTC
Description of problem:
If you add a log pipe script to the /etc/sysconfig/dirsrv-instance_name config file as described in our documentation, systemd does not start the log pipe if you start RHDS.



Version-Release number of selected component (if applicable):
389-ds-base-1.3.6.1-21.el7_4.x86_64



How reproducible:
Always.



Steps to Reproduce:
1. # systemctl stop dirsrv.target
2. # rm /var/log/dirsrv/slapd-instance/access
3. Append to /etc/sysconfig/dirsrv-instance_name:
   python /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-instance/access -m 1000 -u dirsrv -s /var/run/dirsrv/slapd-instance.pid
4. # systemctl start dirsrv.target



Actual results:
Systemd does not run the command(s) in the /etc/sysconfig/dirsrv-instance_name file to start the log pipe.



Expected results:
Log pipe script should work as expected.



Additional info:
Manually starting the log pipe script instead of adding it to the /etc/sysconfig/dirsrv-instance_name file works.

Comment 1 Marc Muehlfeld 2017-12-04 12:06:21 UTC
Created attachment 1362652 [details]
Documentation from the RHDS Admin Guide

Because this does not work at the moment, I removed the
> 19.5. Replacing Log Files with a Named Pipe
section from the RHDS Admin Guide (BZ#1504764).

In case you need the documentation to reproduce the problem, I attached a PDF version of the section to this BZ.

Comment 5 Viktor Ashirov 2023-07-14 10:42:55 UTC
logpipe works with the following configuration:

1. Edit systemd service for the instance:
# systemctl edit --full  dirsrv@localhost

Add in [Unit] section:
Wants=dirsrv-logpipe@.service


2. Create a new unit file for ds-logpipe (access, error and audit logs should all have separate services) 
# cat > /usr/lib/systemd/system/dirsrv-logpipe@.service << EOF
[Unit]
Description=389 Directory Server Logpipe %i.
PartOf=dirsrv.target
Before=dirsrv@.service

[Service]
Type=simple
NotifyAccess=all
PIDFile=/run/dirsrv/slapd-%i-logpipe.pid
ExecStart=/usr/bin/python /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-%i/access.pipe -m 1000 -u dirsrv -s /run/dirsrv/slapd-%i.pid

[Install]
WantedBy=multi-user.target
EOF

3. Reload systemd and enable new service
# systemctl daemon-reload
# systemctl enable dirsrv-logpipe@localhost

4. Update settings for access log so that pipe file won't expire and won't be rotated:
# dsconf localhost config replace nsslapd-accesslog-maxlogsperdir=1
# dsconf localhost config replace nsslapd-accesslog-logexpirationtime=-1
# dsconf localhost config replace nsslapd-accesslog-logrotationtime=-1
# dsconf localhost config replace nsslapd-accesslog=/var/log/dirsrv/slapd-localhost/access.pipe
# dsconf localhost config replace nsslapd-accesslog-logbuffering=off

5. Stop dirsrv and remove /var/log/dirsrv/slapd-localhost/access.pipe created by dirsrv (it will be recreated by the dirsrv-logpipe service)
# systemctl stop dirsrv@localhost
# rm -f /var/log/dirsrv/slapd-localhost/access.pipe

6. Start dirsrv service, with the changes above it should automatically pick up new service and start it:
# systemctl start dirsrv@localhost
# ps -ef | grep [s]lapd
dirsrv      7335       1  0 06:32 ?        00:00:00 /usr/bin/python /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-localhost/access.pipe -m 1000 -u dirsrv -s /run/dirsrv/slapd-localhost.pid
dirsrv      7346       1  2 06:32 ?        00:00:00 /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-localhost -i /run/dirsrv/slapd-localhost.pid


And the logpipe service is automatically stopped when the instance is stopped too:
# systemctl stop dirsrv@localhost
# ps -ef | grep [s]lapd -c
0


I think we can ship these systemd unit files as part of our rpm, but I have doubts if we should do this because of how obscure this feature is. But maybe if we add back documentation for it and ship these files, it would become more popular :) Also, some ds tools rely on log files being actual files and not pipes (for example healthcheck hangs trying to read log files), so we would need to add more changes and do more testing for a feature that is used very little.

Comment 7 Viktor Ashirov 2023-08-04 07:25:50 UTC
An alternative to logpipe is to use log buffering for all log types: https://github.com/389ds/389-ds-base/issues/5842.
Moving to 9.4 for now.

Comment 8 Viktor Ashirov 2023-08-21 16:26:32 UTC
Closing this as WONTFIX in favor of https://bugzilla.redhat.com/show_bug.cgi?id=2233186


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