tail_to_scribe.pl - Tail files and send to a Scribe logging system.
tail_to_scribe.pl [ --config=CONFIG_FILE ] [ --daemon ] [ --dirs DIR1 [DIR2 ...] ] [ --excluded-dir XDIR1 [XDIR2 ...] ] [ --excluded-re REGEXP1 [REGEXP2 ...] ] [ --filter=REGEXP ] [ --follow-symlinks ] [ --no-init ] [ --state-file-name=FILE ] [ --sleep-interval=SECS ] [ --port=PORT ] [ --host=HOST ] [ --level=LEVEL ] [ --category=CATEGORY ]
tail_to_scribe.pl monitors files in a given directory (or set of directories), such as Apache log files in /var/log/httpd, and as the log files are written to, takes the changes and sends them to a running instance of the Scribe logging system.
Run in the background.
The list of directories in which to monitor files for changes. Defaults to /var/log/httpd.
A list of directories to exclude from monitoring. These must be full filesystem paths. Defaults to empty (no exclusions).
A list of exclude regular expressions; any directory paths that match will be excluded from monitoring. Defaults to empty (no exclusions).
A file filter regular expression; only filenames that match will be monitored. Defaults to '[._]log$' (files ending in .log or _log). Set to '.*' to include all files.
If set, follow symbolic links in the filesystem.
If set, any existing state file will be ignored, and only changes from the current file state will be sent. Without --no-init, on the first run (before any state file is created), any existing content in the monitored files will be sent as well as changes (which could be a large amount of data if you have big files).
Name of file in which to store state between runs. Defaults to '.tailtoscribe' in the working directory.
Where a kernel-based file change notification system is not available, this specifies the number of seconds between scans for file changes.
To minimise CPU usage, installing Linux::Inotify2 is highly recommended.
Host and port of Scribe server. Defaults to localhost, port 1463.
Default Scribe logging category. Defaults to 'httpd'.
Default log level. Defaults to 'info'. May be set to any valid Log::Dispatch level (debug, info, notice, warning, error, critical, alert, emergency).
See Log::Dispatch::Scribe for full description of these options.
Write process ID to file FILE. tail_to_scribe.pl will use this file to check if an instance is already running, and refuse to start if the PID in this file corresponds to another tail_to_scribe.pl process. Checks are skipped if no pidfile is given.
Enable debugging to standard error or to file.
Specify the location of the configuration file (an included perl script). Defaults to /etc/tail_to_scribe.conf. A typical configuration file might look like this:
# Set my arg values my %localargs = ( dirs => [ '/var/log/httpd' ], filter => 'access[._]log$', 'exclude-dir' => [ '/var/log/httpd/fastcgi' ], 'state-file-name' => '/var/log/httpd/.tailtoscribe', ); # Copy into args to override defaults $args{$_} = $localargs{$_} for keys %localargs; 1; # Must return a true value
In addition to all of the options available on the command line, a custom message filter may also be included, e.g.
$msg_filter = sub { my ($self, $filename, $line) = @_; return ('info', 'httpd', "$filename\t$line"); };
See "msg_filter" in File::Tail::Scribe for more details on the msg_filter.
HUP signal causes tail_to_scribe.pl to restart. TERM/QUIT/INT cause it to save state and exit.
File::Tail::Scribe
File::Tail::Dir
http://notes.jschutz.net/109/perl/perl-client-for-facebooks-scribe-logging-software
http://github.com/facebook/scribe/
Log::Dispatch::Scribe
Jon Schutz, <jon at jschutz.net> notes.jschutz.net
<jon at jschutz.net>
Please report any bugs or feature requests to bug-file-tail-scribe at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-Tail-Scribe. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-file-tail-scribe at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc File::Tail::Scribe
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Tail-Scribe
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/File-Tail-Scribe
CPAN Ratings
http://cpanratings.perl.org/d/File-Tail-Scribe
Search CPAN
http://search.cpan.org/dist/File-Tail-Scribe/
Copyright 2010 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 File::Tail::Scribe, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::Tail::Scribe
CPAN shell
perl -MCPAN -e shell install File::Tail::Scribe
For more information on module installation, please visit the detailed CPAN module installation guide.