Hi there,
i am trying to parse a .CSV file with a pretty horrible date format.
I am using the Date filter:
date {
match => [ "HelperDate", "dMMyyyy", "ddMMyyyy" ]
}
Some example data:
6112019 -> "_dateparsefailure"
1122019 -> "_dateparsefailure"
8032019 -> "_dateparsefailure"
29112019 -> works
26112019 -> works
28022019 -> works
I think the problem only occurs on single-digit days. I thought "d" would do the job.
Maybe somebody knows how to fix the problem.
I was thinking about a possible workaround: Adding a 0 before the whole field, when the field length is only 7 digits. Unfortunately I am still a beginner, so I don't know if this is even possible.
Thank you for helping me out.
If more information is needed, please let me know.
The if condition will check your field HelperDate against a regex that will test if it is a sequence of 7 digits, if this is true, the first mutate will rename your field and the second one will recreate the HelperDate field adding a 0 in front of the oldHelperDate field.
If you want you can remove this oldHelperDate field with a new mutate:
mutate {
remove_field => ["oldHelperDate"]
}
Simulating this config for the values 29112019 and 61120219 I've got the following output.
See here. Even for "d" or "H" the parser will consume two digits if they are available, and there are no months with 61 days, so it fails to parse 6112019.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.