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.
62
63       --serverpid=P
64              IF  the  server  you  want  to track is already running, you can
65              specify it using this argument.  If the  specified  pid  is  not
66              valid, the script will abort.
67
68       -p|--plugin=/full/path/to/pluginname.py
69              Specify  a  plugin to use.  The plugin must be a python file and
70              must end in .py.  It must specify a function called  plugin  and
71              may specify functions called pre and post.
72
73       pluginname.arg1=value ... pluginname.argN=value
74              You  can  specify  arguments to plugins on the command line.  If
75              there is a plugin  specified  as  --plugin=/full/path/to/plugin‐
76              name.py,  the arguments for that plugin are specified as plugin‐
77              name.argname=value.   The  script  parses  these  arguments  and
78              passes  them  to  the  plugin pre function as a python dict.  IF
79              there is more than one  argument  named  pluginname.argname  the
80              values are passed as a python list.
81

DIRECTORY SERVER NOTES

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

AUTHOR

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

REPORTING BUGS

119       Report bugs to http://bugzilla.redhat.com.
120
122       Copyright © 2009 Red Hat, Inc.
123       This is free software.  You may redistribute copies  of  it  under  the
124       terms of the Directory Server license found in the LICENSE file of this
125       software distribution.  This license is  essentially  the  GNU  General
126       Public License version 2 with an exception for plug-in distribution.
127
128
129
130                               November 24, 2009              DS-LOGPIPE.PY(1)
Impressum