Re: process type escape for log_line_prefix

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

On Fri, Oct 14, 2016 at 4:11 AM, Christoph Berg <myon(at)debian(dot)org> 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? (This would
> obviously need %q to be taught that %a is always valid.)
>

+1 from me on having non-session processes set application_name for logging
purposes, I've long wanted that.

I don't know why you would have to change %q though. I assume you would
just stick %a in from of %q, if that is what you wanted to do. But I've
never used %q myself.

Cheers,

Jeff

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-10-14 16:56:21 Re: Renaming of pg_xlog and pg_clog
Previous Message Tom Lane 2016-10-14 16:51:01 Re: tablesample test failure with small TOAST_TUPLE_THRESHOLD