Various fix in log parser
This commit is contained in:
parent
57f93d8b01
commit
60e522ff5b
|
@ -20,7 +20,7 @@ our @exclude = ();
|
|||
# get command line arguments
|
||||
GetOptions(
|
||||
"debug=i" => \$opts{debug},
|
||||
"log=s" => \$opts{squidlog},
|
||||
"log=s" => \$opts{log},
|
||||
"dbhost=s" => \$opts{dbhost},
|
||||
"dbname=s" => \$opts{dbname},
|
||||
"dbuser=s" => \$opts{dbuser},
|
||||
|
@ -96,16 +96,15 @@ while (defined(my $line=$tail->read)){
|
|||
my ($username, $client_ip, $client_name, $share,
|
||||
$action, $status, $access_mode, $file_src, $file_dst) = undef;
|
||||
|
||||
# Skip logging if listed in --exclude
|
||||
next if (grep { $action eq $_ } @exclude);
|
||||
|
||||
# Oct 12 17:20:24 sme8 smbd[11176]: admin|192.168.7.50|pc10-45|intranet|mkdir|Nouveau dossier
|
||||
if ($line =~ m/^\w+\s\d+\s\d+:\d+:\d+\s\w+\ssmbd\[\d+\]:\s+(\w+)\|(\d+\.\d+\.\d+\.\d+)\|([\w\.]+)\|(\w+)\|(\w+)/){
|
||||
if ($line =~ m/^\w+\s\d+\s\d+:\d+:\d+\s\w+\ssmbd\[\d+\]:\s+(\w+)\|(\d+\.\d+\.\d+\.\d+)\|([\w\.\-]+)\|(\w+)\|(\w+)/){
|
||||
$username = $1;
|
||||
$client_ip = $2;
|
||||
$client_name = $3;
|
||||
$share = $4;
|
||||
$action = $5;
|
||||
# Skip logging if listed in --exclude
|
||||
next if (grep { $action eq $_ } @exclude);
|
||||
}
|
||||
else{
|
||||
printlog("Couldn't parse this line: $line");
|
||||
|
@ -114,7 +113,6 @@ while (defined(my $line=$tail->read)){
|
|||
my @other = split /\|/, $line;
|
||||
|
||||
if (($action eq 'opendir') ||
|
||||
($action eq 'chdir') ||
|
||||
($action eq 'connect') ||
|
||||
($action eq 'disconnect') ||
|
||||
($action eq 'close')){
|
||||
|
|
Loading…
Reference in New Issue