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.
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.
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.
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.