Hi I'm using filebeat to send some session count data to Logstash. The file type is csv and the data looks like this:
...
"01/02/2022 00:00:27.837", "0.99961"
"01/02/2022 00:00:28.853", "0"
"01/02/2022 00:00:29.240", "1.005890494747181"
....
I wanted to parse this data into two columns named "date" and "count", then put each row as a document, so I could plot a timeline graph where the y-axis is "count" and x-axis is "date".
So I tried to format the parsed "date" column to a timefield, but ran into a _dateformatfailure.
Here's part of my logstash.conf file.
filter {
if [fields][codex] == "web-session" {
mutate {
split => [ "message", "," ]
add_field => {
"date" => "%{[message][0]}"
"count" => "%{[message][1]}"
}
remove_field => ["message"]
}
date {
match => [ "date", "MM/dd/YYYY HH:mm:ss.SSS" ]
timezone => "Asia/Seoul"
target => "convert_date"
remove_field => [ "@timestamp"]
}
I used stdout to see how the parsed date field actually looked like, and found that it included quotation marks.
"date" => "\"01/02/2022 00:00:27.837"\"
I solved the problem by adding a gsub to delete the extra quotation marks, but my question is why did the date field contain extra quotation marks in the first place?