DS-LOGPIPE.PY(1)
π DS-LOGPIPE.PY π
okay bestie, welcome to the manual page for ds-logpipe.py, a General Commands Manual situation (section 1, obviously) π
β¨ NAME β¨
ds-logpipe.py β create and read from a named pipe instead of a log file π
πΈ SYNOPSIS πΈ
ds-logpipe.py /full/path/to/namedpipe
[-m maxlinestobuffer] [-u userid] [-s serverpidfile] [-t
servertimeout] [--plugin=/path/to/pluginfile.py] [pluginfile.arg=value]
π¦ DESCRIPTION π¦
so the Named Pipe Log Script lets you swap a log file out for a named pipe that's attached to a script. the server then sends its log output to the script instead of to a log file. and like⦠why would you want that? because it unlocks SO many things, no cap:
- log only certain events, e.g. failed binds, connections from certain ip addresses, etc.
- log only lines that match a certain pattern
- log only the last N lines β genuinely so useful for enabling full error log debug levels in production environments π
- send an email or other notification when a certain event is detected
the script is written in python, and it's plugin girlie π
. by default it logs the last N lines (default 1000). there are two plugins provided β one that logs only failed bind attempts, and one that logs only lines matching given regular expressions. iconic behavior fr fr.
π OPTIONS π
a summary of options is included below, bestie, read them all:
/full/path/to/namedpipeβ Required. the full path and file name of the named pipe. if it doesn't exist, it will be created π. if it exists and it's a named pipe, the script will use it. if it exists and it is not a pipe, the script will abort π. the ownership will be the same as the user running the script (or peep the-uoption below).-m|--maxlines=Nβ number of lines to buffer. default is1000.-u|--userid=userβ the pipe and any other files created by the script will bechown()'d to this userid. this may be a string userid name or a numeric userid value.-s|--serverpidfile=/path/to/servername.pidβ if you want the script to exit when a particular directory server exists, specify the full path to the file containing the server pid. the default is usually something like/var/run/dirsrv/slapd-<instancename>.pidwhere<instancename>is usually the hostname.-t|--servertimeout=Nβ since the serverpidfile may not exist yet when the script is run, the script will wait by default60seconds for the pid file to exist and the server to be started. use this option to specify a different timeout. the-toption only applies when using-sor--serverpidβ otherwise it does nothing π« .--serverpid=Pβ IF the server you want to track is already running, you can specify it using this argument. if the specified pid is not valid, the script will abort π.-p|--plugin=/full/path/to/pluginname.pyβ specify a plugin to use. the plugin must be a python file and must end in.py. it must specify a function calledpluginand may specify functions calledpreandpost.pluginname.arg1=value ... pluginname.argN=valueβ you can specify arguments to plugins on the command line. if there is a plugin specified as--plugin=/full/path/to/pluginname.py, the arguments for that plugin are specified aspluginname.argname=value. the script parses these arguments and passes them to the pluginprefunction as a python dict. IF there is more than one argument namedpluginname.argnamethe values are passed as a python list.
π§ DIRECTORY SERVER NOTES π§
the directory server will usually need to be configured to log to the named pipe instead of the usual log file. for example, use the following LDIF to tell the server to use the file access.pipe for the access log:
dn: cn=config
changetype: modify
replace: nsslapd-accesslog-maxlogsperdir
nsslapd-accesslog-maxlogsperdir: 1
-
replace: nsslapd-accesslog-logexpirationtime
nsslapd-accesslog-logexpirationtime: -1
-
replace: nsslapd-accesslog-logrotationtime
nsslapd-accesslog-logrotationtime: -1
-
replace: nsslapd-accesslog
nsslapd-accesslog: /var/log/dirsrv/slapd-localhost/access.pipe
-
replace: nsslapd-accesslog-logbuffering
nsslapd-accesslog-logbuffering: off
NOTE: before doing this, you should save your current configuration so you can restore it later π
ldapsearch ... -s base -b "cn=config" nsslapd-accesslog-maxlogsperdir
nsslapd-accesslog-logexpirationtime nsslapd-accesslog-logrotationtime
nsslapd-accesslog > savedaccesslog.ldif
the error log and audit log have similarly named configuration attributes e.g. nsslapd-errorlog, nsslapd-auditlog. note that the audit log is disabled by default β use nsslapd-auditlog-logging-enabled: on to enable it.
π AUTHOR π
ds-logpipe.py was written by the 389 Project. slay.
π REPORTING BUGS π
report bugs to https://github.com/389ds/389-ds-base/issues/new β they wanna hear from you bestie π
π COPYRIGHT π
Copyright Β© 2018 Red Hat, Inc.
this is free software. you may redistribute copies of it under the terms of the Directory Server license found in the LICENSE file of this software distribution. this license is essentially the GNU General Public License version 2 with an exception for plug-in distribution.
and that's the whole thing, bestie β this page is dated March 31, 2017 and lives under the name DS-LOGPIPE.PY(1). go forth and pipe those logs π
β¨π¦
π¦ where this page comes from
- arch rolling: 389-ds-base 3.3.1-1 Β· GPL-3.0-only
- centos-stream 10: 389-ds-base 3.3.0-4.el10 Β· GPL-3.0-or-later WITH GPL-3.0-389-ds-base-exception AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT) AND (Apache-2.0 OR LGPL-2.1-or-later OR MIT) AND (Apache-2.0 OR MIT) AND (MIT OR Apache-2.0) AND Unicode-3.0 AND (MIT OR Unlicense) AND Apache-2.0 AND MIT AND MPL-2.0 AND Zlib
- centos-stream 9: 389-ds-base 2.9.0-5.el9 Β· GPL-3.0-or-later WITH GPL-3.0-389-ds-base-exception AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT) AND (Apache-2.0 OR LGPL-2.1-or-later OR MIT) AND (Apache-2.0 OR MIT) AND (MIT OR Apache-2.0) AND Unicode-3.0 AND (MIT OR Unlicense) AND Apache-2.0 AND MIT AND MPL-2.0 AND Zlib
- fedora 43: 389-ds-base 3.1.3-10.fc43 Β· GPL-3.0-or-later WITH GPL-3.0-389-ds-base-exception AND (0BSD OR Apache-2.0 OR MIT) AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR LGPL-2.1-or-later OR MIT) AND (Apache-2.0 OR MIT OR Zlib) AND (Apache-2.0 OR MIT) AND (CC-BY-4.0 AND MIT) AND (MIT OR Apache-2.0) AND Unicode-3.0 AND (MIT OR CC0-1.0) AND (MIT OR Unlicense) AND 0BSD AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MIT AND ISC AND MPL-2.0 AND PSF-2.0 AND Zlib
- fedora 43: 389-ds-base 3.1.5-4.fc43 Β· GPL-3.0-or-later WITH GPL-3.0-389-ds-base-exception AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT) AND (Apache-2.0 OR LGPL-2.1-or-later OR MIT) AND (Apache-2.0 OR MIT) AND (Apache-2.0 OR MIT) AND Unicode-3.0 AND (CC-BY-4.0 AND MIT) AND (MIT OR Unlicense) AND 0BSD AND Apache-2.0 AND BSD-3-Clause AND ISC AND MIT AND MIT AND ISC AND MPL-2.0 AND Zlib
- fedora 44: 389-ds-base 3.2.0-15.fc44 Β· GPL-3.0-or-later WITH GPL-3.0-389-ds-base-exception AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT) AND (Apache-2.0 OR LGPL-2.1-or-later OR MIT) AND (Apache-2.0 OR MIT) AND (CC-BY-4.0 AND MIT) AND (MIT OR Apache-2.0) AND Unicode-3.0 AND (MIT OR CC0-1.0) AND (MIT OR Unlicense) AND 0BSD AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MIT AND ISC AND MPL-2.0 AND PSF-2.0 AND Zlib
- fedora 44: 389-ds-base 3.2.3-5.fc44 Β· GPL-3.0-or-later WITH GPL-3.0-389-ds-base-exception AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT) AND (Apache-2.0 OR LGPL-2.1-or-later OR MIT) AND (Apache-2.0 OR MIT) AND (Apache-2.0 OR MIT) AND Unicode-3.0 AND (CC-BY-4.0 AND MIT) AND (MIT OR Unlicense) AND 0BSD AND Apache-2.0 AND BSD-3-Clause AND ISC AND MIT AND MIT AND ISC AND MPL-2.0 AND Zlib
- nixos 26.05: 389-ds-base 3.1.3
- nixpkgs unstable: 389-ds-base 3.3.0
- opensuse-leap 16.0: 389-ds 3.0.7~git2.2846d5288-160000.1.1 Β· GPL-3.0-or-later AND MPL-2.0
- opensuse-leap 16.0: 389-ds 3.0.7~git2.2846d5288-160000.1.1 Β· GPL-3.0-or-later AND MPL-2.0
- opensuse-leap 16.0: 389-ds 3.0.7~git2.2846d5288-160000.1.1 Β· GPL-3.0-or-later AND MPL-2.0
- opensuse-leap 16.0: 389-ds 3.0.7~git2.2846d5288-160000.1.1 Β· GPL-3.0-or-later AND MPL-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms