DirSrv log

Usage example

# Get array of all lines (including rotated and compresed logs):
standalone.ds_access_log.readlines_archive()
standalone.ds_error_log.readlines_archive()
# Get array of all lines (without rotated and compresed logs):
standalone.ds_access_log.readlines()
standalone.ds_error_log.readlines()
# Get array of lines that match the regex pattern:
standalone.ds_access_log.match_archive('.*fd=.*')
standalone.ds_error_log.match_archive('.*fd=.*')
standalone.ds_access_log.match('.*fd=.*')
standalone.ds_error_log.match('.*fd=.*')
# Break up the log line into the specific fields:
assert(standalone.ds_error_log.parse_line('[27/Apr/2016:13:46:35.775670167 +1000]     slapd started.  Listening on All Interfaces port 54321 for LDAP requests') == {'timestamp': '[27/Apr/2016:13:46:35.775670167 +1000]', 'message': 'slapd starte    d.  Listening on All Interfaces port 54321 for LDAP requests', 'datetime': datetime.datetime(2016, 4, 27, 13, 0, 0, 775670, tzinfo=tzoffset(No    ne, 36000))})

Module documentation

class lib389.dirsrv_log.DirsrvAccessLog(dirsrv)[source]

Class for process access logs

parse_line(line)[source]

This knows how to break up an access log line into the specific fields. @param line - A text line from an access log @return - A dictionary of the log parts

parse_lines(lines)[source]

Parse multiple log lines @param lines - a list of log lines @return - A dictionary of the log parts for each line

class lib389.dirsrv_log.DirsrvErrorLog(dirsrv)[source]

Directory Server Error log class

parse_line(line)[source]

Parse an errors log line @line - a text string from an errors log @return - A dictionary of the log parts

parse_lines(lines)[source]

Parse multiple lines from an errors log @param lines - a lits of strings/lines from an errors log @return - A dictionary of the log parts for each line