Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
File::Tail::Scribe(3) User Contributed Perl DocumentationFile::Tail::Scribe(3)

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

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
       File::Tail::Scribe 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.

perl v5.32.0			  2010-04-07		 File::Tail::Scribe(3)

NAME | SYNOPSIS | DESCRIPTION | PREREQUISITES | CONSTRUCTOR | METHODS | SEE ALSO | AUTHOR | BUGS | SUPPORT | ACKNOWLEDGEMENTS | COPYRIGHT & LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=File::Tail::Scribe&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help