From 7d161a72aeb5f92e63ba4b0b462698fc7dff984a Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Wed, 30 Nov 2022 18:30:46 +0100 Subject: [PATCH] fixed to count lines even when no date has been specified (e.g.: Samba) #115 --- lib/serv.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/serv.pm b/lib/serv.pm index 75ec54d..3510036 100644 --- a/lib/serv.pm +++ b/lib/serv.pm @@ -247,7 +247,7 @@ sub serv_update { $sc[1] = trim($sc[1]); $sc[1] =~ s/^\"//; $sc[1] =~ s/\"$//; # remove leading and trailing quotes my $date = strftime($sc[1], localtime); - $date = qr($date); + $date = qr($date) unless !$date; my @regex = split('\+', trim($sc[2])); my $IN; my $seek_pos = $config->{serv_hist}->{$seek_str} || 0; @@ -279,6 +279,7 @@ sub serv_update { logger("Malformed logfile parameter '$logfile' in service '$s': $!"); undef($logfile); } + $date = "." if !$date; if(defined($logfile)) { while(<$IN>) { if(/$date/) {