Re: how to show time zone with numerical offset in CSV log? - Mailing list pgsql-general

From Adrian Klaver
Subject Re: how to show time zone with numerical offset in CSV log?
Date
Msg-id 56018704.2080600@aklaver.com
Whole thread Raw
In response to Re: how to show time zone with numerical offset in CSV log?  (Michael Zoet <Michael.Zoet@zoet.de>)
List pgsql-general
On 09/22/2015 08:16 AM, Michael Zoet wrote:
>
> ----- Nachricht von Adrian Klaver <adrian.klaver@aklaver.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.klaver@aklaver.com


pgsql-general by date:

Previous
From: Jeff Janes
Date:
Subject: Re: Queuing query
Next
From: Steve Crawford
Date:
Subject: Re: Queuing query