Re: Logwatch: euro date format
Bjorn via Logwatch-devel <[email protected]> Sat, 8 Aug 2020 18:18:05 -0700
| Newsgroups | gmane.comp.log.logwatch.devel |
|---|---|
| Message-ID | <[email protected]> |
Unfortunately that change would break other Logwatch scripts, which in
many cases try to match a string as being at the beginning, after
stripping the date (and perhaps other items). Also, the letsencrypt log
format seems to break the standard syslog format, which does call for a
space after the date.
One way is to specify the string as an argument to the script. For
example, in your case add the following to the pertinent file in
/etc/logwatch/conf/logfiles:
*ApplyEuroDate =3D "%F %T,%L:"
instead of just *ApplyEurodate.
So you can customize it, without changing the script.
Two other items:
- Are you writing a script for letsencrypt logs? I don't think it
currently exists.
- The use of this email list is deprecated; the preferred method is
by using the discussion page at:
https://sourceforge.net/p/logwatch/discussion/
On 8/5/20 12:34 AM, Guillaume LEBAS wrote:
> Hello,
> =
> Logwatch (v7.5.4 and below) uses a trailing space in=A0"ApplyStdDate"
> and=A0"ApplyEuroDate" (adapted from the former) formats.=A0I struggled to
> figure out why it outputs nothing from Let's Encrypt logs, eg.
> "2020-08-02 21:12:16,231:DEBUG:certbot[...]".
> =
> I suggest the following changes:
> =
> diff --git a/logwatch-7.5.4/scripts/shared/applyeurodate
> b/logwatch-dev/scripts/shared/applyeurodate
> index 111c540..8c72ec3 100644
> --- a/logwatch-7.5.4/scripts/shared/applyeurodate
> +++ b/logwatch-dev/scripts/shared/applyeurodate
> @@ -30,7 +30,7 @@ use Logwatch ':dates';
> =
> =A0my $Debug =3D $ENV{'LOGWATCH_DEBUG'} || 0;
> =
> -$SearchDate =3D TimeFilter($ARGV[0] || '%Y-%m-%d %H:%M:%S(,...)? ');
> +$SearchDate =3D TimeFilter($ARGV[0] || '%Y-%m-%d %H:%M:%S(,...)?');
> =
> =A0if ( $Debug > 5 ) {
> =A0 =A0 print STDERR "DEBUG: Inside ApplyEuroDate...\n";
> diff --git a/logwatch-7.5.4/scripts/shared/applystddate
> b/logwatch-dev/scripts/shared/applystddate
> index cc0bd06..e8f8439 100644
> --- a/logwatch-7.5.4/scripts/shared/applystddate
> +++ b/logwatch-dev/scripts/shared/applystddate
> @@ -24,8 +24,8 @@ my $Debug =3D $ENV{'LOGWATCH_DEBUG'} || 0;
> =
> =A0# customize the Timefilter by appending a string:
> =A0# *ApplyStdDate =3D "%H:%M %d/%m/%Y"
> -$SearchDate =3D TimeFilter($ARGV[0] || '%b %e %H:%M:%S ');
> -$SearchDateRsyslog =3D
> TimeFilter('%Y-%m-%dT%H:%M:%S(:?\.[0-9]+)?(:?[+-][0-9]{2}:[0-9]{2}|Z) ');
> +$SearchDate =3D TimeFilter($ARGV[0] || '%b %e %H:%M:%S');
> +$SearchDateRsyslog =3D
> TimeFilter('%Y-%m-%dT%H:%M:%S(:?\.[0-9]+)?(:?[+-][0-9]{2}:[0-9]{2}|Z)');
> =
> =A0# The date might be "Dec 09", but it needs to be "Dec =A09"...
> =A0#$SearchDate =3D~ s/ 0/ =A0/;
> =
> =
> Best regards.
> =
> =
> _______________________________________________
> Logwatch-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/logwatch-devel
> =