Footprintless::Log - A log manager
version 1.03
# Standard way of getting a log use Footprintless; my $log = Footprintless->new()->log(); # Wait for a started message before proceeding $log->follow(until => qr/Started in \d+/); # Check for errors during startup my $error_messages = $log->grep(options => {'ERROR'});
Provides access to read from log files.
A log entity can be a simple entity:
catalina => '/opt/tomcat/logs/catalina.out'
Or it can be a hashref entity containing, at minimum, a file entity:
file
catalina => { file => '/var/log/external/web/catalina.out', hostname => 'loghost.pastdev.com' }
All unspecified command options will be inherited (hostname, ssh, sudo_username, username) from their ancestry. Logs are commonly grouped together:
hostname
ssh
sudo_username
username
web => { hostname => 'web.pastdev.com', logs => { error => '/var/log/httpd/error_log', access => '/var/log/httpd/access_log' catalina => { file => '/opt/tomcat/logs/catalina.out', hostname => 'app.pastdev.com', sudo_username => 'tomcat' } } sudo_username => 'apache' }
Constructs a new log manager configured by the $entities at $coordinate. The supported options are:
$entities
$coordinate
The command options factory to use. Defaults to an instance of Footprintless::CommandOptionsFactory using the localhost instance of this object.
localhost
The command runner to use. Defaults to an instance of Footprintless::CommandRunner::IPCRun.
The localhost alias resolver to use. Defaults to an instance of Footprintless::Localhost configured with load_all().
load_all()
Executes the cat command on this log. The available options are:
cat
Command line options passed to the cat command
Executes the tail command with the -f (follow) option and sets the command runner options to pass the STDOUT from tail to this STDOUT.
tail
-f
STDOUT
Runner options to be passed on to the command runner.
The command will stop once the regex supplied is matched to the output.
Executes the grep command on this log. The available options are:
grep
Command line options passed to the grep command
Executes the head command on this log. The available options are:
head
Command line options passed to the head command
Executes the tail command on this log. The available options are:
Command line options passed to the tail command
Lucas Theisen <lucastheisen@pastdev.com>
This software is copyright (c) 2016 by Lucas Theisen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Please see those modules/websites for more information related to this module.
Footprintless
Config::Entities
Footprintless::CommandOptionsFactory
Footprintless::CommandRunner
Footprintless::Localhost
To install Footprintless, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Footprintless
CPAN shell
perl -MCPAN -e shell install Footprintless
For more information on module installation, please visit the detailed CPAN module installation guide.