Article View: news.software.nntp
Article #90636Re: Unknown entries from news log file
From: Julien ÉLIE
Date: Sat, 29 Jul 2023 10:04
Date: Sat, 29 Jul 2023 10:04
88 lines
4592 bytes
4592 bytes
Adding to my previous message:
>> This is Debian 12, if that's helpful.
>
> https://www.debian.org/releases/bookworm/amd64/release-notes/ch-information.en.html#rsyslog-timestamp-change-affects-logcheck
>
> rsyslog now defaults to “high precision timestamps” which may affect
> other programs that analyze the system logs.
>
>
> Oh, this is an unexpected change which unfortunately breaks daily Usenet
> reports as innreport does not cope with that new setting :-/
>
> I bet inn2 is not the only package which broke with that change...
> It's probably worthwhile a fix in Debian stable (12) as innreport is
> broken. I'll send a mail to Marco (the inn2 package maintainer) as I am
> unsure he reads us here.
Mail sent.
You may also want to open a Debian bug report for the inn2 package if
you wish (so that other people see that issue).
> + # Convert a high-precision timestamp like
> + # 2023-07-23T04:15:01.882775+02:00
> + # to the low-precision timestamp used by innreport.
> + if ($_ =~
> /^(\d+-\d+-\d+T\d+:\d+:\d+)(\.\d+)?([+-]\d+):?(\d+)/) {
> + my $t = Time::Piece->strptime(
> + "$1 $3$4",
> + "%Y-%m-%dT%T %z"
> + );
I've adapted the patch to actually use the local time zone, and not UTC.
It indeed seems like rsyslog uses UTC by default, so if the time zone is
"+00:00" in the logs, innreport tries to get the local time zone, and
use it.
2023-07-23T04:15:01.882775+00:00 in France with an actual +0200 timezone
will mean 2h15 and not 4h15.
--- a/scripts/innreport.in
+++ b/scripts/innreport.in
@@ -95,6 +95,7 @@
use strict;
use Carp qw( cluck confess );
use Time::Local;
+use Time::Piece;
## Default display configuration file (parameter added in INN 2.7.0).
my $DISPLAY_FILE = 'innreport-display.conf';
@@ -452,6 +453,26 @@ while (!eof()) {
my ($res, $day, $hour, $prog, $left);
DECODE:
{
+ # Convert a high-precision timestamp like
+ # 2023-07-23T04:15:01.882775+02:00
+ # to the low-precision timestamp used by innreport.
+ if ($_ =~
/^(\d+-\d+-\d+T\d+:\d+:\d+)(\.\d+)?([+-]\d+):?(\d+)/) {
+ my $tzone = "$3$4";
+ my $t;
+
+ # Retrieve the local time zone, if logging is in UTC.
+ if ("$tzone" eq "+0000") {
+ my $localt = localtime;
+ $tzone = $localt->strftime("%z");
+ $t = Time::Piece->strptime("$1 $tzone",
"%Y-%m-%dT%T %z");
+ } else {
+ $t = Time::Piece->strptime("$1", "%Y-%m-%dT%T");
+ }
+
+ my $newdate = $t->monname . " " . $t->mday . " " . $t->hms;
+ $_ =~ s/^\S+/$newdate/;
+ }
+
($day, $hour, $prog, $left)
= $_ =~ m/^(\S+\s+\S+) (\S+) \S+ (\S+): \[ID \d+ \S+\]
(.*)$/o;
if ($day) { last DECODE; }
--
Julien ÉLIE
« Tempora si fuerint nubila, solus eris. » (Ovide)
Technical Details
Message-ID:
<ua2o6i$8rv8$2@news.trigofacile.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mailReferences:
<86ila9yosb.fsf@building-m.net> <ua2khj$8rv8$1@news.trigofacile.com>Show Full Headers
Complete Article Headers
Message-ID: <ua2o6i$8rv8$2@news.trigofacile.com> Subject: Re: Unknown entries from news log file Date: Sat, 29 Jul 2023 12:04:02 +0200 From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> References: <86ila9yosb.fsf@building-m.net> <ua2khj$8rv8$1@news.trigofacile.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail Newsgroups: news.software.nntp Organization: Groupes francophones par TrigoFACILE Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sat, 29 Jul 2023 10:04:02 -0000 (UTC) Injection-Info: news.trigofacile.com; posting-account="julien"; posting-host="san13-h02-176-143-2-105.dsl.sta.abo.bbox.fr:176.143.2.105"; logging-data="290792"; mail-complaints-to="abuse@trigofacile.com" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cancel-Lock: sha1:oEe0nZahBESif5s6ZHpNbGNctsQ= sha256:8kt1LscHSD4dNIUmQV4COamWTqyOKDfnAjpqeq/OMSw= sha1:ic/w38xaJLTVk8306WDUGxcZXT0= sha256:eBlOD0RBWvvaypLqIuFEXCt3+5oQuHkzeimHEvVl+zQ= In-Reply-To: <ua2khj$8rv8$1@news.trigofacile.com>