The program sipx-log-cut is used to extract a segment from a log file based on
a start and end time. It is called by sipx-snapshot for assembling snapshots.
But the current program doesn't work optimally, because it only processes one
file, and so sipx-snapshot must call it seperately for each file in a logrotate
set (e.g., sipXproxy.log, sipXproxy.log.1, etc.), and for efficiency's sake,
each invocation of sipx-log-cut needs to feed back to sipx-snapshot whether or
not earlier or later files in the set need to be examined. The whole situation
is a mess and is not working at all well. (See XX-6732 and XX-8423.)
I am revising sipx-log-cut so that it performs the extraction from an entire
logrotate set at one time. This avoids complex communication with
sipx-snapshot, sipx-snapshot just gives it the base of the filename set and the
start and end timestamps. The current definition of its functionality is given
in the help message:
Usage: $EXECUTABLE_NAME
{-i|--input} <input log file base>
{-s|--start} <start timestamp>
[{-e|--end} <end timestamp>]
[-t|--stdout]
[-h|--help]
Extract the lines from a logfile and its logrotated-history that fall within
a particular time interval. The output file contains the correct subsets of the
various input files in the correct order.
The base name for the input log files is provided by the -i option.
E.g., "-i /var/log/sipxpbx/sipXproxy.log" identifies all files
/var/log/sipxpbx/sipXproxy.log{,.1,.2,.3,.4,...}{,.gz} as well as all files
/var/log/sipxpbx/sipXproxy.log.YYYYMMDD{,.gz}, that is, both old-style sequenced
logrotate files and dateext-style logrotate files. Base names ending with a
period and digits, or ending with '.gz' are not allowed as they would cause
obscure failures.
The starting timestamp is specified with -s and the ending timestamp with -e.
If -e is omitted, there is no ending cutoff. Timestamps have the format
"yyyy-mm-ddThh:mm:ss", or any prefix thereof; whatever portion is provided is
inclusive at both start and end. The 'T' can be replaced by a space as long as
the value is a single program argument, which usually requires quoting it.
If the input files are not perfectly sorted (which is common), some
lines at the start and end may be lost. However, if the files have only small
deviations from proper time-order and the start and end times are a bit before
and after the interval of interest, all relevant lines will be included in the
output.
The output is written into "<input log file base>.cut", unless -t is specified,
in which case it is sent to standard output.
The log files must be in sipXecs "syslog" format, i.e., the same as
sipXproxy.log.
-h/--help causes the usage message to be printed. Then $EXECUTABLE_NAME
exits with return 1.
Returns: 0 - Success in parsing the arguments and log files; output file may
or may not be null.
1 - Error was seen, or -h/--help was specified.
Examples:
$EXECUTABLE_NAME -i sipXproxy.log -s 2004-12-08T17:45:30 -e
2004-12-08T18:12:52
$EXECUTABLE_NAME -s 17:45:30 -i sipXproxy.log -t
Comments?
Dale
_______________________________________________
sipx-dev mailing list [email protected]
List Archive: http://list.sipfoundry.org/archive/sipx-dev
Unsubscribe: http://list.sipfoundry.org/mailman/listinfo/sipx-dev
sipXecs IP PBX -- http://www.sipfoundry.org/