Compare commits
5 Commits
bba3f40494
...
09e394c3c8
Author | SHA1 | Date |
---|---|---|
Zane C. B-H | 09e394c3c8 | |
Zane C. B-H | 0084fe4bd8 | |
Zane C. B-H | 8be25f2acb | |
Zane C. B-H | 930e2253f9 | |
Zane C. B-H | 92c80d56c2 |
|
@ -16,3 +16,4 @@ pod2htm*.tmp
|
|||
pm_to_blib
|
||||
File-Syslogger-*
|
||||
File-Syslogger-*.tar.gz
|
||||
bin/.exists
|
||||
|
|
7
Changes
7
Changes
|
@ -1,5 +1,8 @@
|
|||
Revision history for File-Syslogger
|
||||
|
||||
0.01 Date/time
|
||||
First version, released on an unsuspecting world.
|
||||
0.0.2 2021-11-27/09:05
|
||||
-Actually update the README.
|
||||
-Correct switches in POD for the script.
|
||||
|
||||
0.0.1 2021-11-27/09:00
|
||||
-Initial release.
|
||||
|
|
1
MANIFEST
1
MANIFEST
|
@ -7,3 +7,4 @@ t/00-load.t
|
|||
t/manifest.t
|
||||
t/pod-coverage.t
|
||||
t/pod.t
|
||||
bin/filesyslogger
|
||||
|
|
12
README
12
README
|
@ -1,16 +1,6 @@
|
|||
File-Syslogger
|
||||
|
||||
The README is used to introduce the module and provide instructions on
|
||||
how to install the module, any machine dependencies it may have (for
|
||||
example C compilers and installed libraries) and any other information
|
||||
that should be provided before the module is installed.
|
||||
|
||||
A README file is required for CPAN modules since CPAN extracts the README
|
||||
file from a module distribution so that people browsing the archive
|
||||
can use it to get an idea of the module's uses. It is usually a good idea
|
||||
to provide version information here so that people can decide whether
|
||||
fixes for the module are worth downloading.
|
||||
|
||||
Tail the specified files and read new lines into syslog.
|
||||
|
||||
INSTALLATION
|
||||
|
||||
|
|
|
@ -100,27 +100,11 @@ filesyslogger - Tails the configured files and sends it to syslog.
|
|||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
filesyslogger [B<-P> <program>] [B<-p> <priority>] [B<-f> <facility>] [B<-t> <config>] [B<-s> <socket>]
|
||||
filesyslogger [B<-c> <config>]
|
||||
|
||||
=head1 FLAGS
|
||||
|
||||
=head2 -P <program>
|
||||
|
||||
The program name to use. If not specified, 'fileSyslogger' is used.
|
||||
|
||||
=head2 -p <priority>
|
||||
|
||||
The priority to use. If not specified, 'notice' is used.
|
||||
|
||||
=head2 -f <facility>
|
||||
|
||||
The facility to use. If not specified, 'daemon' is used.
|
||||
|
||||
=head2 -s <socket>
|
||||
|
||||
The socket to use. If not specified, '/var/run/log' is used.
|
||||
|
||||
=head2 -t <config file>
|
||||
=head2 -c <config file>
|
||||
|
||||
This is the config file to use. If not specified, '/usr/local/etc/filesyslogger.toml' is used.
|
||||
|
||||
|
@ -149,6 +133,8 @@ and forward to syslog. It uses the same keys as above, minus
|
|||
'socket', but with the additional key 'file' for specifying
|
||||
what file.
|
||||
|
||||
File rotation is picked up automatically via POE::Wheel::FollowTail.
|
||||
|
||||
For priority, below are the various valid values.
|
||||
|
||||
emerg
|
||||
|
|
|
@ -13,11 +13,11 @@ File::Syslogger - Use POE to tail a file and read new lines into syslog.
|
|||
|
||||
=head1 VERSION
|
||||
|
||||
Version 0.0.1
|
||||
Version 0.0.2
|
||||
|
||||
=cut
|
||||
|
||||
our $VERSION = '0.0.1';
|
||||
our $VERSION = '0.0.2';
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
|
@ -27,12 +27,11 @@ our $VERSION = '0.0.1';
|
|||
pri=>'alert',
|
||||
facility=>'daemon',
|
||||
files=>{
|
||||
{'sagan_eve'}=>{file=>'/var/log/sagan/eve', program=>'sagan_eve'},
|
||||
{'suricata_eve'}=>{file=>'/var/log/suricata/eve', program=>'suricata_eve'},
|
||||
{'sagan_eve'}=>{file=>'/var/log/sagan/eve', program=>'saganEve'},
|
||||
{'suricata_eve'}=>{file=>'/var/log/suricata/eve', program=>'suricataEve'},
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
=head2 run
|
||||
|
@ -43,7 +42,7 @@ This will die if there are any config issues.
|
|||
|
||||
The following options are optionaal.
|
||||
|
||||
pri - The priority of the logged item.
|
||||
priority - The priority of the logged item.
|
||||
Default is 'notice'.
|
||||
|
||||
facility - The facility for logging.
|
||||
|
@ -59,7 +58,7 @@ The option files is a hash of hashes. It has one mandatory
|
|||
key, 'file', which is the file to follow. All the above
|
||||
options may be used in the sub hashes.
|
||||
|
||||
For pri, below are the various valid values.
|
||||
For priority, below are the various valid values.
|
||||
|
||||
emerg
|
||||
emergency
|
||||
|
@ -95,6 +94,8 @@ For facility, below are the various valid values.
|
|||
local6
|
||||
local7
|
||||
|
||||
File rotation should be picked up POE::Wheel::FollowTail.
|
||||
|
||||
=cut
|
||||
|
||||
sub run {
|
||||
|
@ -131,14 +132,14 @@ sub run {
|
|||
);
|
||||
|
||||
# default to info if none is specified
|
||||
if ( !defined( $opts{pri} ) ) {
|
||||
$opts{pri} = "notice";
|
||||
if ( !defined( $opts{priority} ) ) {
|
||||
$opts{priority} = "notice";
|
||||
}
|
||||
else {
|
||||
# one was specified, convert to lower case and make sure it valid
|
||||
$opts{facility} = lc( $opts{facility} );
|
||||
if ( !defined( $sev_mapping{ $opts{pri} } ) ) {
|
||||
die( '"' . $opts{pri} . '" is not a known facility' );
|
||||
$opts{priority} = lc( $opts{priority} );
|
||||
if ( !defined( $sev_mapping{ $opts{priority} } ) ) {
|
||||
die( '"' . $opts{priority} . '" is not a known priority' );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,17 +206,17 @@ sub run {
|
|||
|
||||
# figure out what facility to use for this item
|
||||
my $item_pri;
|
||||
if ( defined( $opts{files}{$item}{pri} ) ) {
|
||||
if ( defined( $opts{files}{$item}{priority} ) ) {
|
||||
|
||||
# make sure it is valid
|
||||
$item_pri = lc( $opts{files}{$item}{pri} );
|
||||
$item_pri = lc( $opts{files}{$item}{priority} );
|
||||
if ( !defined( $fac_mapping{$item_pri} ) ) {
|
||||
die( '"' . $item_pri . '" in "' . $item . '" is not a known facility' );
|
||||
}
|
||||
}
|
||||
else {
|
||||
# none specified, so using default
|
||||
$item_pri = $opts{pri};
|
||||
$item_pri = $opts{priority};
|
||||
}
|
||||
$item_pri=$sev_mapping{$item_pri};
|
||||
|
||||
|
|
Loading…
Reference in New Issue