ADD: module documentation
This commit is contained in:
parent
d57f1e182e
commit
08b0e407bb
@ -1,21 +1,37 @@
|
||||
package OSSEC::Log;
|
||||
|
||||
# ABSTRACT: OSSEC::Log - Module for logging OSSEC log messages
|
||||
# ABSTRACT: Module/class for simplifying logging of OSSEC log messages
|
||||
use strict;
|
||||
use warnings;
|
||||
use Moose;
|
||||
use DateTime;
|
||||
use File::Basename;
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This Module/Class is part of the OSSEC distribution.
|
||||
It simplifies logging to files, e.g. for active response. You are able
|
||||
to use different logging types (info,error,fatal,debug) and select the file to log
|
||||
to. See the methods below.
|
||||
|
||||
=cut
|
||||
|
||||
=attr ossecPath
|
||||
|
||||
base path to the ossec installation B<default> /var/ossec
|
||||
|
||||
Type: String
|
||||
|
||||
=cut
|
||||
has 'ossecPath' => (is => 'rw', isa => 'Str' , default => "/var/ossec" );
|
||||
|
||||
=attr file
|
||||
|
||||
in which file to log the messages
|
||||
In which file to log the messages. The file should be given as the path relative to the
|
||||
OSSEC configuration file.
|
||||
|
||||
Type: String
|
||||
|
||||
=cut
|
||||
has 'file' => (is => 'rw', isa => 'Str');
|
||||
@ -146,13 +162,9 @@ sub log
|
||||
|
||||
# create the full path to the file
|
||||
my $file = $self->ossecPath() . "/" . $self->file();
|
||||
my $dir = dirname($file);
|
||||
|
||||
# open the logfile
|
||||
open(my $fh1, ">>", "/tmp/log");
|
||||
|
||||
print $fh1 $file . "\n";
|
||||
|
||||
close $fh1;
|
||||
readpipe("mkdir -p $dir");
|
||||
|
||||
my $dt = DateTime->now;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user