🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #90635

Re: Unknown entries from news log file

#90635
From: Julien ÉLIE
Date: Sat, 29 Jul 2023 09:01
122 lines
5030 bytes
Hi John,

> In my daily report, I always have a lot of stuff in the "Unknown
> entries" section:
> 
> Unknown entries from news log file:
> First 50 / 3351 lines (1.5%)
> 2023-07-23T04:15:01.882775+00:00 localhost innd: ctlinnd command E

Timestamps in my news log files look like:

[news.notice]
Jul 29 04:15:01 news innd[3334925]: ctlinnd command E

[news]
Jul 29 04:35:01.632 + feed.usenet-fr.net [...]


I've just checked, and it seems that the innreport script only handles 
lines with a format like the above ones:

     ($day, $hour, $prog, $left)
       =~ m/^(\S+\s+\S+) (\S+) \S+ (\S+): (.*)$/o;

It is the low-precision timestamp used by syslog.



> 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.


FWIW, the high-precision timestamp is enabled with a line like this one 
in rsyslog.conf:
   $ActionFileDefaultTemplate RSYSLOG_FileFormat
instead of RSYSLOG_TraditionalFileFormat (low-precision).



Anyway, innreport should really support high-precision timestamps. 
Could you please try the following patch and tell me whether it works 
for your next daily reports?

I've tested it with a test file on my system, and innreport correctly 
recognizes "2023-07-23T04:15:01.882775+00:00" with it:

Control commands to INND:
Command                                                        Number
logmode                                                             1

TOTAL: 1                                                            1





--- scripts/innreport.in
+++ 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,18 @@ 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 $t = Time::Piece->strptime(
+                    "$1 $3$4",
+                    "%Y-%m-%dT%T %z"
+                );
+                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; }





I've used Time::Piece as it is a Perl core module.



> It sort of looks like the contents of news.notice are also ending up in
> /var/log/news/news, but I'm not sure why or how to change that. Any
> suggestions?

Are you really sure "2023-07-23T04:15:01.882775+00:00 localhost innd: 
ctlinnd command E" appears in /var/log/news/news?  (and not only in 
/var/log/news/news.notice?)
Your rsyslog rules explicitly mention news.notice.

-- 
Julien ÉLIE

« Tempora si fuerint nubila, solus eris. » (Ovide)
Technical Details
Message-ID: <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
References: <86ila9yosb.fsf@building-m.net>

Show Full Headers
Complete Article Headers
Message-ID: <ua2khj$8rv8$1@news.trigofacile.com>
Subject: Re: Unknown entries from news log file
Date: Sat, 29 Jul 2023 11:01:39 +0200
From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid>
References: <86ila9yosb.fsf@building-m.net>
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 09:01:39 -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:jIJN5v5mF3ETCQMKVX3eRZ060sA= sha256:TmlKNsBE2cSAKV5G1XRITeqct8PwIxGeW/bywlB4egU= sha1:1FruscsmM8abYCCkkD4bMc9vAJ8= sha256:ZLS/OqSiOS6ljRzuF6WTPsE0p7bQEscYI3Lwla0h2Nc=
In-Reply-To: <86ila9yosb.fsf@building-m.net>