Re: process type escape for log_line_prefix

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Christoph Berg <myon(at)debian(dot)org>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: process type escape for log_line_prefix
Date: 2016-10-16 00:43:40
Message-ID: CAMkU=1y4BLvHtX=r98hdFUGfSq3xUFR_UghjANFzPnoSTrw_Ow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 14, 2016 at 11:51 AM, Andres Freund <andres(at)anarazel(dot)de> wrote:

> On 2016-10-14 13:11:51 +0200, Christoph Berg wrote:
> > Re: Michael Paquier 2016-02-10 <CAB7nPqS=wBbZzBcty1KyN-
> 5Y9bPXZ+deJbfcCtebf06eF2Uyvg(at)mail(dot)gmail(dot)com>
> > > On Mon, Feb 8, 2016 at 11:32 PM, Andres Freund <andres(at)anarazel(dot)de>
> wrote:
> > > > Frequently when reading postgres logs to do some post mortem analysis
> > > > I'm left wondering what process emitted an error/log message. After
> the
> > > > fact it's often hard to know wether an error message was emitted by a
> > > > user backend or by something internal, say the checkpointer or
> > > > autovacuum. Logging all process starts is often impractical given
> the
> > > > log volume that causes.
> > > >
> > > > So I'm proposing adding an escape displaying the process title (say
> 'k'
> > > > for kind?). So %k would emit something like "autovacuum worker
> process",
> > > > "wal sender process" etc.
> > >
> > > It would be nice to get something consistent between the ps output and
> > > this new prefix, say with for example a miscadmin.h parameter like
> > > MyProcName.
> > >
> > > > I'm thinking it might make sense to give normal connections "" as the
> > > > name, they're usually already discernible.
> > >
> > > Yeah, that sounds fine for me. What about background workers? I would
> > > think that they should use BackgroundWorker->bgw_name.
> >
> > (Rediscovering an old horse)
> >
> > Couldn't these processes just set %a = application_name?
>
> It'd not get me what I'd want, no. E.g for walsenders that'd not be
> parsable in a meaningful way. I really would like an escape that'd
> always output one of:
> Postmaster, Startup, BgWriter, Checkpointer, WalWriter, WalReceiver,
> AutovacLauncher, AutovacWorker, PgArch, PgStat, SysLogger, Backend,
> BackgroundWorker.
>

I'm not sure what you are proposing. Which of those 13 strings you listed
would a walsender advertise itself as? Why would stuffing one of those
words into %k be different than stuffing that same word into %a, where %a
would otherwise be the empty string? The only problem I can see is if
someone has an application which calls itself "WalReceiver", for example,
so you can't distinguish a real WalReceiver from a self-declared
WalReceiver.

I'd be happy to replace the %a in my log_line_prefix with %a%k, but I don't
really see the point of of %a and %k being different things.

Cheers,

Jeff

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2016-10-16 06:29:58 Re: pg_stat_statements and non default search_path
Previous Message Jim Nasby 2016-10-16 00:38:13 Re: pg_stat_statements and non default search_path