scribe_cat.pl - Reads log messages from standard input and sends to a scribe instance
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\""
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.
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
Host and port of Scribe server. Defaults to localhost, port 1463.
Default Scribe logging category, used where there is no --category-re or no match on any given category-re.
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
See Log::Dispatch::Scribe for full description of these options.
Enable debugging to standard error or to file.
Log::Dispatch::Scribe, File::Tail::Scribe
Apache httpd piped log documentation, http://httpd.apache.org/docs/2.2/logs.html#piped
Jon Schutz, <jon at jschutz.net> http://notes.jschutz.net
<jon at jschutz.net>
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.
bug-log-logdispatch-scribe at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc scribe_cat.pl
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Log-Dispatch-Scribe
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Log-Dispatch-Scribe
CPAN Ratings
http://cpanratings.perl.org/d/Log-Dispatch-Scribe
Search CPAN
http://search.cpan.org/dist/Log-Dispatch-Scribe/
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.
To install Log::Dispatch::Scribe, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Dispatch::Scribe
CPAN shell
perl -MCPAN -e shell install Log::Dispatch::Scribe
For more information on module installation, please visit the detailed CPAN module installation guide.