fixed to count lines even when no date has been specified (e.g.: Samba) #115

This commit is contained in:
Jordi Sanfeliu 2022-11-30 18:30:46 +01:00
parent 4629f87c46
commit 7d161a72ae
1 changed files with 2 additions and 1 deletions

View File

@ -247,7 +247,7 @@ sub serv_update {
$sc[1] = trim($sc[1]); $sc[1] = trim($sc[1]);
$sc[1] =~ s/^\"//; $sc[1] =~ s/\"$//; # remove leading and trailing quotes $sc[1] =~ s/^\"//; $sc[1] =~ s/\"$//; # remove leading and trailing quotes
my $date = strftime($sc[1], localtime); my $date = strftime($sc[1], localtime);
$date = qr($date); $date = qr($date) unless !$date;
my @regex = split('\+', trim($sc[2])); my @regex = split('\+', trim($sc[2]));
my $IN; my $IN;
my $seek_pos = $config->{serv_hist}->{$seek_str} || 0; my $seek_pos = $config->{serv_hist}->{$seek_str} || 0;
@ -279,6 +279,7 @@ sub serv_update {
logger("Malformed logfile parameter '$logfile' in service '$s': $!"); logger("Malformed logfile parameter '$logfile' in service '$s': $!");
undef($logfile); undef($logfile);
} }
$date = "." if !$date;
if(defined($logfile)) { if(defined($logfile)) {
while(<$IN>) { while(<$IN>) {
if(/$date/) { if(/$date/) {