The parse_date function ignores the timezone parameter?

Hello,

The pipeline parse_date function is defined as follows: parse_date(value, pattern, [locale], [timezone]) : DateTime, with the parameters further defined as:

value	String		Date string to parse
pattern	String		The pattern to parse the date with, see http://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html
locale	String		The locale to parse the date with, see https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html
timezone	String		The timezone to apply to the date, defaults to UTC

The way I understand it, the timezone parameter is a “converter” to apply to the parsed date; the date will be parsed as a Date object, i.e. in a time zone defined by the parsed string, and then will be converted to the time zone defined by the timezone parameter. Is that correct, or did I misunderstand?

Now, assuming I got it right, I’m not sure the argument is actually used. In the source code, timezone seems to come from somewhere different than the other arguments. I haven’t dug deeper into the code to see how this is used, but it looks odd.

the value is parsed with the pattern to create a date object. If that does not contain a timezone you can give that additional information with timezone. That then allows Graylog to store the date object in UTC with the given offset.

Does that makes sense to you?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.