1DS-LOGPIPE.PY(1)            General Commands Manual           DS-LOGPIPE.PY(1)
2
3
4

NAME

6       ds-logpipe.py - Create and read from a named pipe instead of a log file
7

SYNOPSIS

9       ds-logpipe.py /full/path/to/namedpipe
10              [-m maxlinestobuffer] [-u userid] [-s serverpidfile] [-t server‐
11       timeout] [--plugin=/path/to/pluginfile.py] [pluginfile.arg=value]
12
13

DESCRIPTION

15       The Named Pipe Log Script allows you to replace a log file with a named
16       pipe attached to a script. The server can then send the log output to a
17       script instead of to a log file. This allows you to do  many  different
18       things such as:
19
20        *  log only certain events e.g. failed binds, connections from certain
21       ip addresses, etc.
22        * log only lines that match a certain pattern
23        * log only the last N lines - useful for enabling full error log debug
24       levels in production environments
25        * send an email or other notification when a certain event is detected
26
27       The  script  is  written in python, and allows plugins. By default, the
28       script will log the last N lines (default 1000). There are two  plugins
29       provided  - one to log only failed bind attempts, and one that will log
30       only lines that match given regular expressions.
31

OPTIONS

33       A summary of options is included below.
34
35       /full/path/to/namedpipe
36              Required - full path and file name of the named  pipe.  If  this
37              does not exist, it will be created.  If it exists and is a named
38              pipe, the script will use it.  If it exists and is not  a  pipe,
39              the  script  will  abort.  The ownership will be the same as the
40              user running the script (or see the -u option below).
41
42       -m|--maxlines=N
43              Number of lines to buffer - default is 1000
44
45       -u|--userid=user
46              The pipe and any other files  created  by  the  script  will  be
47              chown()'d to this userid.  This may be a string userid name or a
48              numeric userid value.
49
50       -s|--serverpidfile=/path/to/servername.pid
51              If you want the script  to  exit  when  a  particular  directory
52              server  exists, specify the full path to the file containing the
53              server   pid.    The   default   is   usually   something   like
54              /var/run/dirsrv/slapd-<instancename>.pid where <instancename> is
55              usually the hostname
56
57       -t|--servertimeout=N
58              Since the serverpidfile may not exist yet  when  the  script  is
59              run, the script will wait by default 60 seconds for the pid file
60              to exist and the server to be started.  Use this option to spec‐
61              ify  a  different timeout. The -t option only applies when using
62              -s or --serverpid - otherwise it does nothing.
63
64       --serverpid=P
65              IF the server you want to track  is  already  running,  you  can
66              specify  it  using  this  argument.  If the specified pid is not
67              valid, the script will abort.
68
69       -p|--plugin=/full/path/to/pluginname.py
70              Specify a plugin to use.  The plugin must be a python  file  and
71              must  end  in .py.  It must specify a function called plugin and
72              may specify functions called pre and post.
73
74       pluginname.arg1=value ... pluginname.argN=value
75              You can specify arguments to plugins on the  command  line.   If
76              there  is  a  plugin specified as --plugin=/full/path/to/plugin‐
77              name.py, the arguments for that plugin are specified as  plugin‐
78              name.argname=value.   The  script  parses  these  arguments  and
79              passes them to the plugin pre function as  a  python  dict.   IF
80              there  is  more  than  one argument named pluginname.argname the
81              values are passed as a python list.
82

DIRECTORY SERVER NOTES

84       The directory server will usually need to be configured to log  to  the
85       named pipe instead of the usual log file.  For example, use the follow‐
86       ing LDIF to tell the server to use the file access.pipe for the  access
87       log:
88        dn: cn=config
89        changetype: modify
90        replace: nsslapd-accesslog-maxlogsperdir
91        nsslapd-accesslog-maxlogsperdir: 1
92        -
93        replace: nsslapd-accesslog-logexpirationtime
94        nsslapd-accesslog-logexpirationtime: -1
95        -
96        replace: nsslapd-accesslog-logrotationtime
97        nsslapd-accesslog-logrotationtime: -1
98        -
99        replace: nsslapd-accesslog
100        nsslapd-accesslog: /var/log/dirsrv/slapd-localhost/access.pipe
101        -
102        replace: nsslapd-accesslog-logbuffering
103        nsslapd-accesslog-logbuffering: off
104
105       NOTE:  Before doing this, you should save your current configuration so
106       you can restore it later.
107        ldapsearch ... -s base -b "cn=config"  nsslapd-accesslog-maxlogsperdir
108       nsslapd-accesslog-logexpirationtime   nsslapd-accesslog-logrotationtime
109       nsslapd-accesslog > savedaccesslog.ldif
110
111       The  error  log  and  audit  log  have  similarly  named  configuration
112       attributes  e.g.  nsslapd-errorlog,  nsslapd-auditlog.   Note  that the
113       audit log  is  disabled  by  default  -  use  nsslapd-auditlog-logging-
114       enabled: on to enable it.
115

AUTHOR

117       ds-logpipe.py was written by the 389 Project.
118

REPORTING BUGS

120       Report bugs to https://github.com/389ds/389-ds-base/issues/new
121
123       Copyright © 2018 Red Hat, Inc.
124       This  is  free  software.   You may redistribute copies of it under the
125       terms of the Directory Server license found in the LICENSE file of this
126       software  distribution.   This  license  is essentially the GNU General
127       Public License version 2 with an exception for plug-in distribution.
128
129
130
131                                March 31, 2017                DS-LOGPIPE.PY(1)
Impressum