3.6. logging

3.6.1. NAME

logging - Guardian Digital WebTool module interface to system and application logs.

3.6.2. SYNOPSIS

use logging;
my $logging = new logging($page);

3.6.3. DESCRIPTION

This Guardian Digital WebTool module provides an interface to listing, retrieving, and searching system and application logs.

3.6.4. METHODS

get_system_logs()

This function returns hash reference(name,path) of system log(11), kernel messages(12), webtool audit(13) and user audit logs(14). See example for understanding number notations.

Example Usage:

my $logref  = $logging->get_system_logs();
my $syslog  = $logref->{11}->{'name'};
my $syspath = $logref->{11}->{'path'};

get_app_logs()

This function returns hash reference(name,path) of application log files like Mail server log(11), PHP error log(12), MySQL error log(13). see example for number notations.

Example Usage:

my $logref   = $logging->get_app_logs();
my $maillog  = $logref->{11}->{'name'};
my $mailpath = $logref->{11}->{'path'};

get_web_logs()

This returns hash reference(name,path) of all website log files. It basically reads through all virtual hosts hosted in web server file and depends on the port it selects which error log file it should choose(e.g port 443 :SSL port).

Example Usage:

my $logref  = $logging->get_web_logs();
my $weblog  = $logref->{11}->{'name'};
my $webpath = $logref->{11}->{'path'};

read_log($)

This function is used to read last 50 lines of the logfile. Logfile name is provided in as an argument.

Example Usage:

@logdata = $logging->read_log($file);

search_log($$)

This function is used to search a specific pattern in last 50 lines of the logfile. Logfile name and search pattern is provided as arguments.

Example Usage:

@logdata = $logging->search_log($file, $search);

3.6.5. AUTHORS

Ryan W. Maple <ryan@guardiandigital.com>

3.6.6. COPYRIGHT AND LICENSE

Copyright Guardian Digital, Inc., All Rights Reserved