Logstash date filter and Timestamp

I have field called created_date in my table and the data is in the format - 2020-07-14 10:41:24.879884 +05:30. Want to parse this data and map it to the timestamp field in logstash. Used the below log pattern in the config file

        date {
            match => ["created_date", "yyyy-MM-dd HH:mm:ss.SSSSS ZZ", "ISO8601"]
            target => "@timestamp"
}
}

I'll try to answer the question you didn't ask:

2020-07-14 10:41:24.879884 +05:30 — 6 digits
yyyy-MM-dd HH:mm:ss.SSSSS ZZ — 5 S

Still the same.

Is the "- " part of the field value? If it is, you'll have to add it to your date pattern. If it isn't, I don't know what's wrong because this works fine for me:

input {
  stdin{}
}
filter {
  date {
    match => ["message", "yyyy-MM-dd HH:mm:ss.SSSSSS ZZ", "ISO8601"]
    target => "@timestamp"
  }
}
output {
  stdout{}
}
{
       "message" => "2020-07-14 10:41:24.879884 +05:30",
      "@version" => "1",
    "@timestamp" => 2020-07-14T05:11:24.879Z,
          "host" => "#####"
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.