|
|
@ -20,7 +20,7 @@ our @exclude = (); |
|
|
|
# get command line arguments |
|
|
|
# get command line arguments |
|
|
|
GetOptions( |
|
|
|
GetOptions( |
|
|
|
"debug=i" => \$opts{debug}, |
|
|
|
"debug=i" => \$opts{debug}, |
|
|
|
"log=s" => \$opts{squidlog}, |
|
|
|
"log=s" => \$opts{log}, |
|
|
|
"dbhost=s" => \$opts{dbhost}, |
|
|
|
"dbhost=s" => \$opts{dbhost}, |
|
|
|
"dbname=s" => \$opts{dbname}, |
|
|
|
"dbname=s" => \$opts{dbname}, |
|
|
|
"dbuser=s" => \$opts{dbuser}, |
|
|
|
"dbuser=s" => \$opts{dbuser}, |
|
|
@ -96,16 +96,15 @@ while (defined(my $line=$tail->read)){ |
|
|
|
my ($username, $client_ip, $client_name, $share, |
|
|
|
my ($username, $client_ip, $client_name, $share, |
|
|
|
$action, $status, $access_mode, $file_src, $file_dst) = undef; |
|
|
|
$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 |
|
|
|
# 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; |
|
|
|
$username = $1; |
|
|
|
$client_ip = $2; |
|
|
|
$client_ip = $2; |
|
|
|
$client_name = $3; |
|
|
|
$client_name = $3; |
|
|
|
$share = $4; |
|
|
|
$share = $4; |
|
|
|
$action = $5; |
|
|
|
$action = $5; |
|
|
|
|
|
|
|
# Skip logging if listed in --exclude |
|
|
|
|
|
|
|
next if (grep { $action eq $_ } @exclude); |
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
else{ |
|
|
|
printlog("Couldn't parse this line: $line"); |
|
|
|
printlog("Couldn't parse this line: $line"); |
|
|
@ -114,7 +113,6 @@ while (defined(my $line=$tail->read)){ |
|
|
|
my @other = split /\|/, $line; |
|
|
|
my @other = split /\|/, $line; |
|
|
|
|
|
|
|
|
|
|
|
if (($action eq 'opendir') || |
|
|
|
if (($action eq 'opendir') || |
|
|
|
($action eq 'chdir') || |
|
|
|
|
|
|
|
($action eq 'connect') || |
|
|
|
($action eq 'connect') || |
|
|
|
($action eq 'disconnect') || |
|
|
|
($action eq 'disconnect') || |
|
|
|
($action eq 'close')){ |
|
|
|
($action eq 'close')){ |
|
|
|