Bug#1068425: pflogsumm: Postfix logs days in month < 10 with leading zeroes, pflogsumm expects space padding

2024-04-15 Thread Magnus Stenman

Hi,

I was using (in postfix main.cf)
maillog_file = /var/log/maillog


Logs look like:

Apr 15 17:09:23 mail postfix/master[125626]: daemon started -- version 
3.7.10, configuration /etc/postfix


If postfix logging is unchanged from debian conf (no maillog_file=), I 
get timestamps like:


2024-04-15T17:08:12.982938+02:00

and the logs appear both in the journal and in /var/log/mail.log



pflogsumm args:

pflogsumm -d yesterday \
    -u 20 -h 20 \
    --problems_first \
    --smtpd_stats \
    --ignore_case \
    --bounce_detail=0 \
    --deferral_detail=0 \
    --reject_detail=0 \
    --smtpd_warning_detail=0 \
    --no_no_msg_size \
    --iso_date_time \
    --verp_mung=2 \
    /var/log/maillog

/magnus

On 2024-04-12 15:03, Sven Hoexter wrote:

On Fri, Apr 05, 2024 at 01:01:52AM +0200, Magnus Stenman wrote:

Hi,
sorry for the delay, I just started to briefly look into the issue.


Pflogsumm reports zero mails on day 1-9 of every month

Stock debian postfix version

Patch:
--- /usr/sbin/pflogsumm.orig2024-04-05 00:45:38.214914066 +0200
+++ /usr/sbin/pflogsumm 2024-04-05 00:45:44.710952673 +0200
@@ -1518,7 +1518,7 @@
  }
  my ($t_mday, $t_mon, $t_year) = (localtime($time))[3,4,5];

-return sprintf("%s %2d", $monthNames[$t_mon], $t_mday), 
sprintf("%04d-%02d-%02d", $t_year+1900, $t_mon+1, $t_mday);
+return sprintf("%s %02d", $monthNames[$t_mon], $t_mday), 
sprintf("%04d-%02d-%02d", $t_year+1900, $t_mon+1, $t_mday);
  }

It's been a while I looked into pflogsumm and for me it still works,
but I do not rely for a long time on the traditional BSD syslog format.
Also Debian doesn't do that by default for some time, so I'm wondering
what exactly your logs look like. If possible please provide a sample.
Also how did you invoke pflogsumm, any flags in use?

According to RFC3164 section 4.1.2 there isn't zero padding but space
padding in the traditional timestamp. Likely there is a bug
somewhere, maybe even in one of the other patches I carry in the
package, but I believe the format returned here, without zero
padding on the day of the month is correct.

Sven




Bug#1068425: pflogsumm: Postfix logs days in month < 10 with leading zeroes, pflogsumm expects space padding

2024-04-12 Thread Sven Hoexter
On Fri, Apr 05, 2024 at 01:01:52AM +0200, Magnus Stenman wrote:

Hi,
sorry for the delay, I just started to briefly look into the issue.

> Pflogsumm reports zero mails on day 1-9 of every month
> 
> Stock debian postfix version
> 
> Patch:
> --- /usr/sbin/pflogsumm.orig2024-04-05 00:45:38.214914066 +0200
> +++ /usr/sbin/pflogsumm 2024-04-05 00:45:44.710952673 +0200
> @@ -1518,7 +1518,7 @@
>  }
>  my ($t_mday, $t_mon, $t_year) = (localtime($time))[3,4,5];
> 
> -return sprintf("%s %2d", $monthNames[$t_mon], $t_mday), 
> sprintf("%04d-%02d-%02d", $t_year+1900, $t_mon+1, $t_mday);
> +return sprintf("%s %02d", $monthNames[$t_mon], $t_mday), 
> sprintf("%04d-%02d-%02d", $t_year+1900, $t_mon+1, $t_mday);
>  }

It's been a while I looked into pflogsumm and for me it still works,
but I do not rely for a long time on the traditional BSD syslog format.
Also Debian doesn't do that by default for some time, so I'm wondering
what exactly your logs look like. If possible please provide a sample.
Also how did you invoke pflogsumm, any flags in use?

According to RFC3164 section 4.1.2 there isn't zero padding but space
padding in the traditional timestamp. Likely there is a bug
somewhere, maybe even in one of the other patches I carry in the
package, but I believe the format returned here, without zero
padding on the day of the month is correct.

Sven



Bug#1068425: pflogsumm: Postfix logs days in month < 10 with leading zeroes, pflogsumm expects space padding

2024-04-04 Thread Magnus Stenman
Package: pflogsumm
Version: 1.1.5-8
Severity: important
Tags: patch
X-Debbugs-Cc: st...@hkust.se

Dear Maintainer,

Pflogsumm reports zero mails on day 1-9 of every month

Stock debian postfix version

Patch:
--- /usr/sbin/pflogsumm.orig2024-04-05 00:45:38.214914066 +0200
+++ /usr/sbin/pflogsumm 2024-04-05 00:45:44.710952673 +0200
@@ -1518,7 +1518,7 @@
 }
 my ($t_mday, $t_mon, $t_year) = (localtime($time))[3,4,5];

-return sprintf("%s %2d", $monthNames[$t_mon], $t_mday), 
sprintf("%04d-%02d-%02d", $t_year+1900, $t_mon+1, $t_mday);
+return sprintf("%s %02d", $monthNames[$t_mon], $t_mday), 
sprintf("%04d-%02d-%02d", $t_year+1900, $t_mon+1, $t_mday);
 }

 # if there's a real domain: uses that.  Otherwise uses the IP addr.



-- System Information:
Debian Release: 12.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-18-cloud-amd64 (SMP w/2 CPU threads; PREEMPT)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages pflogsumm depends on:
ii  libdate-calc-perl  6.4-2
ii  perl   5.36.0-7+deb12u1

pflogsumm recommends no packages.

pflogsumm suggests no packages.

-- no debconf information