Re: Custom timestamp format in logs

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Custom timestamp format in logs
Date: 2014-12-14 16:36:27
Message-ID: CABUevEzY1Vk2h1hvD1X+mzBdWoNtza1P6PnOe2sEy1u4jr0EHg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Dec 13, 2014 at 3:50 PM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:
>
> Hi all,
>
> This week, we heard about a user willing to use a custom timestamp
> format across a set of services to improve the debugability of the
> whole set, Postgres being one of them. Unfortunately datestyle does
> not take into account the logs. Would it be worth adding a new GUC
> able to control the timestamp format in the logs?
>
> We could still redirect the logs with syslog and have a custom
> timestamp format there, but in the case of this particular user syslog
> was a no-go. Looking at the code, timestamp format is now hardcoded in
> setup_formatted_log_time and setup_formatted_start_time when calling
> pg_strftime @ elog.c, so it doesn't seem to be much complicated to do.
>
> Opinions? This thread is here for that.
>

A separate GUC seems kind of weird. Wouldn't it be better with something
like %(format)t or such in the log_line_prefix itself in that case? That
could also be expanded to other parameters, should we need them?

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-12-14 16:46:18 Re: Custom timestamp format in logs
Previous Message Craig Ringer 2014-12-14 15:57:06 Re: Commitfest problems