From patchwork Sat Mar 16 22:57:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 2153 Return-Path: Received: from mail01.ipfire.org (mail01.i.ipfire.org [172.28.1.200]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail01.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web07.i.ipfire.org (Postfix) with ESMTPS id 5A94788A13D for ; Sat, 16 Mar 2019 11:57:34 +0000 (GMT) Received: from mail01.i.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id 44M1Cd2rprz50w3x; Sat, 16 Mar 2019 11:57:33 +0000 (GMT) Received: from tuxedo.stevee (unknown [46.125.249.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 44M1CZ1StWz50w3x; Sat, 16 Mar 2019 11:57:30 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201801; t=1552737450; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references; bh=JCLW7TdgskT2klB/e/wTKf1fbCGroLF391+Eg1Y/0Ys=; b=CQqzgIrzADtIfnUImb6cP356Egh4ajM+jvIHeT/lq6/73N5IitP5EqXTlHsqHjIzuCmYLH 6ei0wKPtNmWo46998fZIsuwDyXVJhWwtKOq7swKMxf1nbtMdOKeOwMJE2ppTkVvcOOf21h FcsVnt+KA4QMBPcVRZYICz0ZlH0RJfBEJ5IbTOWLnl/j2t+6mJnqSkRinNAUWlVm/FJHPg K5YTwcgYacFQL9vdM9Lg/x04PkL/oR0NXmLOs12Gzmmb+uSx1404I9kGSjxoi3xlAmrDk2 aOYlJ/u1G3CJ0Donk8ENg9H5ppS09Q72I5iJgykgGEH+kMAF7tMfqC6t0aVj9A== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH] logs.cgi/ids.dat: Fixup processing dates from logfiles which contains a year Date: Sat, 16 Mar 2019 12:57:25 +0100 Message-Id: <20190316115725.5400-1-stefan.schantl@ipfire.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Spamd-Result: default: False [5.86 / 11.00]; ARC_NA(0.00)[]; BAYES_SPAM(0.86)[80.07%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; BROKEN_CONTENT_TYPE(1.50)[]; DKIM_SIGNED(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; MID_CONTAINS_FROM(1.00)[]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:~]; ASN(0.00)[asn:8412, ipnet:46.124.0.0/15, country:AT] Authentication-Results: mail01.ipfire.org; auth=pass smtp.auth=stevee smtp.mailfrom=stefan.schantl@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" X-Spam: Yes Signed-off-by: Stefan Schantl --- html/cgi-bin/logs.cgi/ids.dat | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/html/cgi-bin/logs.cgi/ids.dat b/html/cgi-bin/logs.cgi/ids.dat index e374f5711..1447a06f0 100644 --- a/html/cgi-bin/logs.cgi/ids.dat +++ b/html/cgi-bin/logs.cgi/ids.dat @@ -460,7 +460,14 @@ sub processevent } } $line++; - unless ($line == 1 || $date ne "$monthstr/$daystr") { &append; } + + # Split the date into single chunks. + my ($month, $day, $year) = split('/', $date); + + # Check if all data is collected and the date of the event fits the desired date to + # get displayed. + if ($line gt 1 || "$month/$day" eq "$monthstr/$daystr") { &append; } + close(LOG); } }