#34 logwatch doesn't recognoze new rsyslog date format

v7.4.2
closed
5
2014-12-24
2014-04-24
No

scripts/shared/applystddate computes incorrect MDay in SearchDateRsyslog part (ISO date handling) resulting in empty reports. Patching it like below makes things right again.

@@ -39,7 +39,7 @@
       print $ThisLine;
    } elsif ($ThisLine =~ /^$SearchDateRsyslog /o) {
       $ThisLine =~ s/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})\.[0-9]+[+-][0-9]{2}:[0-9]{2} //o;
-      print POSIX::strftime("%b %e %H:%M:%S", $6, $5, $4, $3+1, $2-1, $1 - 1900) . " " . $ThisLine;
+      print POSIX::strftime("%b %e %H:%M:%S", $6, $5, $4, $3, $2-1, $1 - 1900) . " " . $ThisLine;
    } elsif ($ThisLine =~ m/(Mon|Tue|Wed|Thu|Fri|Sat|Sun) $SearchDate \d{4}/o) {
       print $ThisLine;
    }

Discussion

  • Stefan Jakobs

    Stefan Jakobs - 2014-09-09

    What disto do you use?
    What version of rsyslog is this and which template is configured in rsyslog.conf?
    Can you post some example log lines?

     
    • Dmitri Zoubkov

      Dmitri Zoubkov - 2014-09-09

      openSUSE 13.1 (Bottle) (i586)

      rsyslog-7.4.7-2.8.1.i586

      There's nothing specifically configured in rsyslog.conf, so it would use its defaults.

      Here some lines from /log/messages of today (09-09-2014), most of services log in the same format.

      2014-09-09T21:24:25.709219+02:00 osx systemd[1]: Starting Session 3625 of user root.
      2014-09-09T21:24:25.709529+02:00 osx systemd-logind[1031]: New session 3625 of user root.
      2014-09-09T21:24:25.709742+02:00 osx systemd[1]: Started Session 3625 of user root.
      2014-09-09T21:30:01.715258+02:00 osx /usr/sbin/cron[16826]: pam_unix(crond:session): session opened for user root by (uid=0)
      2014-09-09T21:30:01.716538+02:00 osx /usr/sbin/cron[16827]: pam_unix(crond:session): session opened for user root by (uid=0)
      2014-09-09T21:30:01.718668+02:00 osx systemd[1]: Starting Session 3627 of user root.
      2014-09-09T21:30:01.718900+02:00 osx systemd[1]: Started Session 3627 of user root.
      2014-09-09T21:30:01.719084+02:00 osx systemd[1]: Starting Session 3626 of user root.
      

      Note: POSIX:strftime interprets MDay in range 1-31, so does ISO date format, regarding this the reason for the increment +1 in mentioned script isn't quite clear.

       
      Last edit: Dmitri Zoubkov 2014-09-09
  • Stefan Jakobs

    Stefan Jakobs - 2014-09-09
    • status: open --> pending
    • assigned_to: Stefan Jakobs
    • Group: v7.4.1 --> v7.5.0
    • Priority: 2 --> 5
     
  • Stefan Jakobs

    Stefan Jakobs - 2014-12-24

    commited to rev 272

     
  • Stefan Jakobs

    Stefan Jakobs - 2014-12-24
    • status: pending --> closed
    • Group: v7.5.0 --> v7.4.2
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks