Graylog 4.1.10, Elastic 6.8.22
Hey,
I am ingesting log messages from custom software. Most messages seem to come through just fine but then there are some that fail due to “failed to parse date field”.
An example of failing message:
[2022-01-20T10:39:10,699][DEBUG][o.e.a.b.TransportShardBulkAction] [2CEfq1M] [graylog_37][0] failed to execute bulk item (index) index {[graylog_deflector][message][6f60b1e4-79cc-11ec-ae42-0050568815d4], source[{“gl2_accounted_message_size”:436,“SourceModuleType”:“im_file”,“level”:6,“log”:"{{dateFormat alertMessage.timestamp format=‘dd.MM.yyyy HH:mm:ss’}}",“gl2_remote_ip”:“X.X.X.X”,“gl2_remote_port”:57242,“streams”:[“5ed618ec5d8362036e809302”,“5e7b0ac45d8362099efe24ae”,“000000000000000000000001”,“5c94dee4f7f28c69cba861e1”],“gl2_message_id”:“01FSVA7EZZYKJQ30R185K54FBF”,“source”:“worker02”,“message”:"{“log”:"{{dateFormat alertMessage.timestamp format=‘dd.MM.yyyy HH:mm:ss’}}\n",“stream”:“stdout”,“time”:“2022-01-20T08:39:06.344427Z”}",“gl2_source_input”:“5bbc795d11973e0a7f631721”,“EventReceivedTime”:“2022-01-20 10:39:09”,“SourceModuleName”:“alert”,“stream”:“stdout”,“gl2_source_node”:“cb4a9a8c-e692-4e55-947f-8fc89edef6b4”,“time”:“2022-01-20 10:39:06”,“timestamp”:“2022-01-20 08:39:09.000”}]}
org.elasticsearch.index.mapper.MapperParsingException: failed to parse field [time] of type [date] in document with id ‘6f60b1e4-79cc-11ec-ae42-0050568815d4’
So, I understand the problem is this part in original log: “time”:"2022-01-20T08:39:06.344427Z
Previously, I didn’t have a custom format for the field “time” and I saw this kind of explanation after that error:
Caused by: java.lang.IllegalArgumentException: Invalid format: “2022-01-20 00:00:17” is malformed at " 00:00:17"
This suggests that “2022-01-20T08:39:06.344427Z” gets successfully transformed into “2022-01-20 08:39:06” but is not parsed after that?
So I tried fixing it by creating a custom format for the field and managed to get a change in explanation:
Caused by: java.lang.IllegalArgumentException: failed to parse date field [2022-01-20 11:03:36] with format [8yyyy-MM-dd’T’HH:mm:ss.SSSSSS||date_optional_time||8yyyy-MM-dd’T’HH:mm:ss.SSSSSSSSS||8yyyy-MM-dd’ 'HH:mm:ss||date_time_no_millis]
Caused by: java.time.format.DateTimeParseException: Failed to parse with all enclosed parsers
I suppose ES 6 doesn’t support format strict_date_optional_time_nanos
as graylog complains about that when trying to add it, that’s why there is the nanosecond pattern as well as. I have tried with and without 8 in front as well.
I have tried several format strings that being the latest, but still it fails on maybe 5 messages out of 2000. I almost thought I got it after quoting that space in “correct looking” format, but no.
Any suggestions??
Thanks!