Fix parsing of log entries produced by sendmail process with 7-digit PID (#1561587)

Resolves: #1561587
This commit is contained in:
Jan Synacek 2018-05-21 10:56:03 +02:00
parent f7520cd1a7
commit 7db4a45b12
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,41 @@
From ddbd80b1efaa6e95536d0262985f13147208e775 Mon Sep 17 00:00:00 2001
From: Oleg Girko <ol@infoserver.lv>
Date: Wed, 28 Mar 2018 15:43:12 +0100
Subject: [PATCH] Fix pattern for sendmail queue ID to parse ones with PID
having 7 digits.
Sendmail 8.15 uses the following format for queue id:
- 6 letters or digits dependent on date and time,
- 2 letters or digits dependent on random sequence ID,
- PID of sendmail process formatted by snprintf using "%06d" format.
Format "%06d" means that resulting string has *minimal* length of 6 characters,
padded with leading zeroes if necessary.
But if PID is greater than 999999, the resulting string can be longer,
up to 7 characters if kernel.pid_max sysctl parameter is big enough.
By default it's 32768, but can be up to 4194304 on 64-bit systems.
This change fixes logwatch to parse sendmail log lines produced by
sendmail processes that have 7-digit PID.
Signed-off-by: Oleg Girko <ol@infoserver.lv>
---
scripts/services/sendmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/services/sendmail b/scripts/services/sendmail
index d97e7a2..1acd733 100644
--- a/scripts/services/sendmail
+++ b/scripts/services/sendmail
@@ -387,7 +387,7 @@ for my $i (0..9) {
}
# QueueID formats: in 8.11 it was \w{7}\d{5}, in 8.12+ it is \w{8}\d{6}
-my $QueueIDFormat = "(?:\\w{7,9}\\d{5}|NOQUEUE)";
+my $QueueIDFormat = "(?:\\w{7,9}\\d{5,7}|NOQUEUE)";
# ENOENT refers to "no such file or directory"
my $ENOENT = Errno::ENOENT();
--
2.14.3

View File

@ -1,7 +1,7 @@
Summary: A log file analysis program
Name: logwatch
Version: 7.4.3
Release: 9%{?dist}
Release: 10%{?dist}
License: MIT
Group: Applications/System
URL: http://www.logwatch.org/
@ -21,6 +21,7 @@ Patch5: logwatch-journal.patch
# https://sourceforge.net/p/logwatch/git/ci/ed6eb62f40cb97f71f3df4d982682de68cdf1037/
Patch6: logwatch-journald-source.patch
Patch7: logwatch-sshd-2.patch
Patch8: logwatch-sendmail-id.patch
BuildRequires: perl-generators
Requires: grep mailx
Requires: perl(Date::Manip)
@ -45,6 +46,7 @@ of the package on many systems.
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
rm -f scripts/services/*.orig
%build
@ -144,6 +146,9 @@ echo "# Configuration overrides for specific logfiles/services may be placed her
%{_mandir}/man*/*
%changelog
* Mon May 21 2018 Jan Synáček <jsynacek@redhat.com> - 7.4.3-10
- Fix parsing of log entries produced by sendmail process with 7-digit PID (#1561587)
* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 7.4.3-9
- Escape macros in %%changelog