Re: how to show time zone with numerical offset in CSV log?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Michael Zoet <Michael(dot)Zoet(at)zoet(dot)de>, pgsql-general(at)postgresql(dot)org
Subject: Re: how to show time zone with numerical offset in CSV log?
Date: 2015-09-22 16:51:16
Message-ID: 56018704.2080600@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 09/22/2015 08:16 AM, Michael Zoet wrote:
>
> ----- Nachricht von Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> ---------
> Datum: Tue, 22 Sep 2015 07:46:24 -0700
>
>>> Zone names: Time zone names ('z') cannot be parsed.
>>
>> Some more digging found that DateTimeFormat can deal with Z which is
>> either the offset or the timezone id, in particular as ZZZ.
>>
>> http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html
>>
>>
>> Zone: 'Z' outputs offset without a colon, 'ZZ' outputs the offset with
>> a colon, 'ZZZ' or more outputs the zone id.
>
> That's why I am asking "how to get the numerical offset printed in the
> log files". Logstash can parse the numerical value. Otherwise I will
> always have a parsing error in Logstash. We could live with this but if
> it is possible I'd like to change this on the Postgres level. But I
> never thought that this is much more complicated than expected.

From the above link:

Z time zone offset/id zone -0800; -08:00;
America/Los_Angeles

So DateTimeFormat does understand names, though not necessarily
abbreviations which is what z is for. The Logstash match is supposed to
understand what DateTimeFormat parses.

>
>>
>> The timezone names in Postgres are available from:
>>
>> select * from pg_timezone_names ;
>>
>> So in addition to Tom's suggestion, you might try setting the
>> log_timezone to a name. Examples: Europe/Brussels for CEST, Etc/UTC
>> for UTC
>>
>
> As far as I understand the log_timezone configuration option, it will
> always print me the name if I use a name for the time zone. And that is
> the no go for Logstash. So I really need a numerical value to parse it
> with Logstash.
>
> Michael
>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2015-09-22 17:45:57 Re: Queuing query
Previous Message Jeff Janes 2015-09-22 16:26:08 Re: Queuing query