Hello Team,
I have the following Problem and would love to have some help
1. Describe your incident:
I’m receiving docker logs in my graylog-instance and I want to extract the date from the message field and add it to a new field called timestamp_message_created field.
The part of my message, that is interesting looks like the following:
2023-05-09 16:24:01.9051|
And I’m using the following pipeline rule for the processing:
rule “Rule_1”
when
has_field(“message”)
then
let pattern = "%{DATA:timestamp}\|;
let matches = grok(pattern, to_string($message.message));
let date_string = to_string(matches[“timestamp”]);
let created_date = parse_date(date_string,“yyyy-MM-dd HH:mm:ss.SSSS”, “CEST”, “Europe/Zurich”);
set_field(“timestamp_message_created”, created_date);
end
Basically this works fine, but the problem is, that my field that I’m adding has afterwards the data type string and not date and my parsed date looks like this:
2023-05-09T16:24:01.905Z
Is there a way, how I can succefully parse this string in a valid date format and add it to my new field?
2. Describe your environment:
I’m using graylog version 4.3, alongside the elasticsearch version 7.10.2 and the mongo version 4.2
My logs are generated by NLog
3. What steps have you already taken to try and solve the problem?
I have already tried different timezone, patterns and also the flex_parse_date() method, but neither of them was working as expected.
Thank you in advance for the support