is applied in a rule to incoming log messages.
I get a lot of (in 30 minutes ~ 300000) processing failures with this message:
failure_details
Value <26/Feb/2025:09:26:42 +0100> caused exception: Invalid format: “26/Feb/2025:09:26:42 +0100” is malformed at “/Feb/2025:09:26:42 +0100”.
failure_type
processing
message
Failed to process message with id ‘01JN0NWQBP04RJH43RNNS4CFD6’: Replaced invalid timestamp value in message <89a3ea50-f41b-11ef-9e5f-0050568773de> with current time
Just a quick guess, maybe it is because the square brackets ([]) are not quoted? What I would try is to use the System -> Grok Patterns -> Create Pattern modal in Graylog with your sample message to test if it is extracting fields properly. Also, I like using this Grok Pattern Generator (click on “Grok Patterns” in the upper left) to bootstrap the initial pattern and iterate over it until it does what I want.
thank you for the answer. I did not know that Graylog itself can test and even create GROK patterns.
Yes, the GROK pattern in my first post is missing the brackets .
Somehow they got lost while copying the pattern into the post, in the original in Graylog the brackets are existing in the right place.
But I don’t understand the “failure message”. Something seems wrong with the date format HTTPDATE.
In tests (in Graylog or online) everything works fine, the GROK pattern matches. But in Graylog I get those processing errors.
This is what I don’t understand.
now, the processing errors are gone, but the datetime field is not interpreted as it should. For example the field [28/Feb/2025:09:04:17 +0100]
results in this Graylog fields:
INT
+0100
MINUTE
04
MONTH
Feb
MONTHDAY
28
SECOND
17
TIME
09:04:17
YEAR
2025
This is correct. But the resulting timestamp has a wrong timezone information:
The timezone should be +0100 but in fact is 0000.
You could use something like the below or set the timezone of your user.
rule "replace timestamp"
when
has_field("timestamp")
then
let new_date = parse_date(to_string($message.timestamp), "yyyy-MM-dd'T'HH:mm:ss.SSS","CET"); ///Central European Time
set_field("timestamp1", new_date);
end
thank you for the suggestion. But this would mean to adjust the rule very soon, when the time zone switches from CET to CEST because of summertime (daylight saving time).
Right now the problem is not urgent enough to investigate further.
Thanks.