GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  FILE::TAIL::SCRIBE (3)

.ds Aq ’

NAME

File::Tail::Scribe - Monitor and send the tail of files to a Scribe logging system.

CONTENTS

SYNOPSIS



  use File::Tail::Scribe;

  my $log = File::Tail::Scribe->new(
    directories => $args{dirs},
    msg_filter => sub {
        my ($self, $filename, $line) = @_;
        return (info, httpd, "$filename\t$line");
        },
    );

  $log->watch_files();



DESCRIPTION

Basically this module connects File::Tail::Dir to Log::Dispatch::Scribe.

It 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.

PREREQUISITES

The Scribe and Thrift Perl modules from their respective source distributions are required and not available as CPAN dependencies. Further information is available here: <http://notes.jschutz.net/109/perl/perl-client-for-facebooks-scribe-logging-software>

CONSTRUCTOR

    new



  $tailer = File::Tail::Scribe->new(%options);



Creates a new instance. Options are:
o directories, filter, exclude, follow_symlinks, sleep_interval, statefilename, no_init, max_age

See the equivalent options in File::Tail::Dir: directories in File::Tail::Dir, filter in File::Tail::Dir, exclude in File::Tail::Dir, follow_symlinks in File::Tail::Dir, sleep_interval in File::Tail::Dir, statefilename in File::Tail::Dir, no_init in File::Tail::Dir, max_age in File::Tail::Dir.

o scribe_options

This is a hash containing all of the options to pass to <Log::Dispatch::Scribe/new>.

o msg_filter

An optional coderef that can be used to preprocess messages before they are sent to Scribe. The code is passed ($self, $filename, $line), i.e. the File::Tail::Scribe instance, the filename of the file that changed, and the line of text that was added. It must return ($level, $category, $message), i.e. the log level (info, debug etc), the Scribe category, and the log line that will be sent to Scribe. An example:



  msg_filter => sub {
    my $self = shift;
    my $filename = shift;
    my $line = shift;
    $filename =~ s{^.*/}{};                   # remove leading dirs
    $filename =~ s{\.[^.]*$}{};               # remove extension
    $filename ||= default;                  # in case everything gets removed

    return (info, httpd, "$filename\t$line");
  };



If no msg_filter is provided, the log level is given by default_level, the category is the filename after removing leading paths and filename extensions, and the message is the log line as given.

o default_level

Default logging level. May be set to any valid Log::Dispatch level (debug, info, notice, warning, error, critical, alert, emergency). Defaults to ’info’.

METHODS

<B>File::Tail::ScribeB> provides the same methods as File::Tail::Dir, plus the following:
o msg_filter
o default_level

Set/get the msg_filter and default_level attributes as described above.

SEE ALSO

o tail_to_scribe.pl, a program that uses this module
o <http://notes.jschutz.net/109/perl/perl-client-for-facebooks-scribe-logging-software>
o <http://github.com/facebook/scribe/>
o Log::Dispatch::Scribe

AUTHOR

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

BUGS

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.

SUPPORT

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



    perldoc File::Tail::Scribe



You can also look for information at:
o RT: CPAN’s request tracker

<http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Tail-Scribe>

o AnnoCPAN: Annotated CPAN documentation

<http://annocpan.org/dist/File-Tail-Scribe>

o CPAN Ratings

<http://cpanratings.perl.org/d/File-Tail-Scribe>

o Search CPAN

<http://search.cpan.org/dist/File-Tail-Scribe/>

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

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.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 FILE::TAIL::SCRIBE (3) 2010-04-07

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.