[TNM] log_line_prefix not working (I think)
Norman Yamada
nyamada at millburncorp.com
Wed Feb 15 14:14:58 UTC 2012
Dear Greg --
I must be missing something.
I've got a postgresql 9.0.6 server on debian 4.0
> log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d '
> log_destination = 'syslog'
sample output from log looks like this:
> Feb 15 08:23:13 nydbprod1 postgres[9787]: [5-1] 2012-02-15 08:23:13 EST [9787]: [2-1] user=appuser2,db=tmc FATAL: password authentication failed for user "appuser2"
> Feb 15 08:23:14 nydbprod1 postgres[9788]: [5-1] 2012-02-15 08:23:14 EST [9788]: [2-1] user=appuser2,db=tmc FATAL: password authentication failed for user "appuser2"
but when I run tail_n_mail against this server with
.tailnmailrc
> log_line_prefix ='%t [%p]: [%l-1] user=%u,db=%d '
> pgmode: syslog
with config file for tail_n_mail looking like this:
> ## Config file for the tail_n_mail program
> ## This file is automatically updated
> ## Last updated: Wed Feb 15 08:25:01 2012
> EMAIL: nyamada at millburncorp.com
> MAILSUBJECT: dbmaster1 HOST Postgres fatal errors UNIQUE : NUMBER
>
> FILE: /var/log/pgsql
> LASTFILE: /var/log/pgsql
> INCLUDE: FATAL
But when I do a dry run on this log, it fails to find the FATAL statements:
nydbprod1:~# perl /usr/local/bin/tail_n_mail test_config.txt --dryrun --verbose
> Log line prefix regex: (?-xism:^((\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d \w\w\w\w?) \[(\d+)\]: \[\d+\-1\] user=[\[\w\]]*,db=[\[\w\]]* )(.*))
> Log line prefix regex2: (?-xism:^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d \w\w\w\w? \[\d+\]: \[\-1\] user=,db= )
> Log line prefix regex3: (?-xism:^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d \w\w\w\w?)
> File: /var/log/pgsql Offset: 0 Size: 2,344,547 Maxsize: 80,000,000
> Inclusion: (?-xism:FATAL)
> No new lines found in file /var/log/pgsql
> Setting offset to 2344547
>
Unless I'm missing something, the log line prefix regex you're using doesn't match my log line -- %t on my server seems to give \w\w\w \d\d, not \d\d\d\d-\d\d-\d\d
Should I be configuring something differently? I'm using this log_line_prefix because we run pg_fouine on our logs and it wants this log line prefix.
Thanks for any help,
Norman Yamada
More information about the TNM
mailing list