[Date Prev][Date Next]
statslog perl filter
I've found this script useful when playing with server logs.
Should I commit it somewhere? It doesn't really fit into the current
OpenLDAP source tree, but I don't know where else to put it - there is
no 'OpenLDAP tools' distribution. Maybe we should start one.
Usage: statslog [options] [logfiles; may be .gz or .bz2 files]
Output selected parts of slapd's statslog output (loglevel 256) from
syslog or stderr, grouping log lines by LDAP connection.
--brief -b Brief output (omit time, host/process name/ID).
--exclude=RE -e RE Exclude connections whose output matches REgexp.
--include=RE -i RE Only include connections matching REgexp.
--EXCLUDE=RE -E RE As --exclude, but case-sensitive.
--INCLUDE=RE -I RE As --include, but case-sensitive.
--loose -l RE Exclude "loose" lines (lines with no connection)
matching RE. E.g. -l'$' excludes all loose lines.
--sort -s Sort the input files, oldest first.
--trace -t Print file names as they are read. Implies -u.
--units -u Print active connections at end of each file.
Multiple --exclude and --include options may be used.
Note that --trace and --units make the --exclude and --include options
unreliable for connections that span more than one log file.
BTW, I'm a bit unsatisfied with the --loose option. It sort of does the
opposite of what it looks like - exclude instead of include. But I've
found it's current functionality the most convenient one, except perhaps
'exclude all' would be a nicer default - and even less intuitive.