ADD: module documentation

This commit is contained in:
Dominik Meyer 2019-12-20 12:31:40 +01:00
parent d57f1e182e
commit 08b0e407bb
No known key found for this signature in database
GPG Key ID: B4C312B600606B64

View File

@ -1,21 +1,37 @@
package OSSEC::Log; 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 strict;
use warnings; use warnings;
use Moose; use Moose;
use DateTime; 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 =attr ossecPath
base path to the ossec installation B<default> /var/ossec base path to the ossec installation B<default> /var/ossec
Type: String
=cut =cut
has 'ossecPath' => (is => 'rw', isa => 'Str' , default => "/var/ossec" ); has 'ossecPath' => (is => 'rw', isa => 'Str' , default => "/var/ossec" );
=attr file =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 =cut
has 'file' => (is => 'rw', isa => 'Str'); has 'file' => (is => 'rw', isa => 'Str');
@ -146,13 +162,9 @@ sub log
# create the full path to the file # create the full path to the file
my $file = $self->ossecPath() . "/" . $self->file(); my $file = $self->ossecPath() . "/" . $self->file();
my $dir = dirname($file);
# open the logfile readpipe("mkdir -p $dir");
open(my $fh1, ">>", "/tmp/log");
print $fh1 $file . "\n";
close $fh1;
my $dt = DateTime->now; my $dt = DateTime->now;