NAME

scribe_cat.pl - Reads log messages from standard input and sends to a scribe instance

SYNOPSIS

scribe_cat.pl --host=HOST --port=PORT --level=LEVEL --category=CATEGORY

# Example Apache CustomLog entry
CustomLog "|scribe_cat.pl --category=www" "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""

DESCRIPTION

A simple script that uses the functionality of Log::Dispatch::Scribe to read from standard input and send to a scribe instance. Offers categorisation by regular expression match on the log message.

Apache Logging

This script is suitable for use with Apache httpd for piped logging per the CustomLog example shown above.

Note that special characters in the command given in the Apache configuration file need to be escaped; for example, this command line:

/usr/local/bin/scribe_cat.pl --category-re 'local$1= /\?p=([^ ]+)'

would be specified in the configuration file as:

CustomLog "|/usr/local/bin/scribe_cat.pl --category-re \'local$1= /\\\\?p=([^ ]+)\'" combined

OPTIONS

--host, --port

Host and port of Scribe server. Defaults to localhost, port 1463.

--category=CATEGORY

Default Scribe logging category, used where there is no --category-re or no match on any given category-re.

--category-re CATEGORY=REGEXP [ --category-re CATEGORY=REGEXP ...]

Specify a mapping from regular expression match on each log message to category name. --category-re may be specified more than once to specify a set of mappings. Each mapping is of the form CATEGORY=REGEXP, where CATEGORY is the category name and may include substitutions from the matching expression, using $1, $2 etc. REGEXP is any Perl regexp, using () for grouping to create the $1, $2 references.

The regular expressions are tried in the order that they are specified on the command line, and the first match is used.

Example:

  --category-re 'foo$1=www\.([^ ]+)' --category-re bar=BAR --category-re baz='(?i:BAZ)'

Log Message       |     Category  |     Notes
--------------------------------------------------
www.acme.com xyz  | fooacme.com   | Back-subst of acme.com
my new BAR baz    | bar           | Matches BAR before BAZ
bar my new baz    | baz           | Case insensitive match on bar
--retry-plan-a=MODE, --retry-plan-b=MODE, --retry-buffer-size=SIZE, --retry-count=COUNT, --retry-delay=DELAY

See Log::Dispatch::Scribe for full description of these options.

--debug, --debug=FILE

Enable debugging to standard error or to file.

SEE ALSO

Log::Dispatch::Scribe, File::Tail::Scribe

Apache httpd piped log documentation, http://httpd.apache.org/docs/2.2/logs.html#piped

AUTHOR

Jon Schutz, <jon at jschutz.net> http://notes.jschutz.net

BUGS

Please report any bugs or feature requests to bug-log-logdispatch-scribe at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Log-Dispatch-Scribe. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc scribe_cat.pl

You can also look for information at:

COPYRIGHT & LICENSE

Copyright 2009 Jon Schutz, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.