[TNM] pgAdmin III entries getting picked up when they shouldn't be

Greg Sabino Mullane greg at endpoint.com
Thu Jun 16 14:45:25 UTC 2016


On Wed, Jun 15, 2016 at 08:37:08AM -0400, Douglas J Hunley wrote:
> I've got tnm (tail_n_mail-1.27.0-1.rhel6.noarch) installed and configured
> thusly:
...
> 2016-06-14 23:51:11 UTC [31610]: [3-1] user=trisdbuser,db=postgres,app=pgAdmin
> III - Browser,client=10.130.2.95 LOG:  duration: 22.603 ms  statement:
> SELECT version();
...
> but that didn't work. I'm not even sure why the logs entries get caught as
> there is no ERROR/FATAL/PANIC present. My .tailnmailrc is:
> log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h '

The issue seems to be that pgadmin is using whitespace inside it's 
SET application_name calls, which means tail_n_mail is failing to parse 
the lines correctly, and thus those lines you see are not really "matching" 
but are unknown, what-are-those-doing-there lines. A quick fix may be to 
change your log_line_prefix in your .tailnmailrc to:

log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d,app'

Not ideal, I know. You could also remove the app=%a from your Postgres 
log_line_prefix, if you are not actively using it.

The problem is that we have no way of knowing when the application 
name ends and when the next field begin (in this case, a comma and 
the word 'client'). As the application_name field is very free-form, 
and does not get quoted, it can contain a comma. I do not know if 
there is a canonical solution to this problem, but perhaps we can at 
least devise some sort of clever workaround? Ideas and patches 
welcome.

-- 
Greg Sabino Mullane greg at endpoint.com
End Point Corporation
PGP Key: 0x14964AC8
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
URL: <https://mail.endcrypt.com/pipermail/tnm/attachments/20160616/ec711bb8/attachment.sig>


More information about the TNM mailing list