# Logstash date filter and Timestamp

**URL:** <https://discuss.elastic.co/t/logstash-date-filter-and-timestamp/241110>\
**Category:** Logstash\
**Created:** [July 14, 2020, 10:31am UTC](https://discuss.elastic.co/t/logstash-date-filter-and-timestamp/241110 "2020-07-14T10:31:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikita\_Shetty](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nikita_shetty/32/46090_2.png) [@Nikita\_Shetty](https://discuss.elastic.co/u/Nikita_Shetty)\
**Post date:** [July 14, 2020, 10:31am UTC](https://discuss.elastic.co/t/logstash-date-filter-and-timestamp/241110/1 "2020-07-14T10:31:24Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![Jenni](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jenni/32/29684_2.png) [@Jenni](https://discuss.elastic.co/u/Jenni)\
**Post date:** [July 14, 2020, 10:42am UTC](https://discuss.elastic.co/t/logstash-date-filter-and-timestamp/241110/2 "2020-07-14T10:42:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nikita\_Shetty](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nikita_shetty/32/46090_2.png) [@Nikita\_Shetty](https://discuss.elastic.co/u/Nikita_Shetty)\
**Post date:** [July 14, 2020, 11:00am UTC](https://discuss.elastic.co/t/logstash-date-filter-and-timestamp/241110/3 "2020-07-14T11:00:39Z")

</div>

Still the same.

---

<div class="post-metadata">

**Author:** ![Jenni](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jenni/32/29684_2.png) [@Jenni](https://discuss.elastic.co/u/Jenni)\
**Post date:** [July 14, 2020, 12:29pm UTC](https://discuss.elastic.co/t/logstash-date-filter-and-timestamp/241110/4 "2020-07-14T12:29:06Z")

</div>

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:

```auto
input {
  stdin{}
}
filter {
  date {
    match => ["message", "yyyy-MM-dd HH:mm:ss.SSSSSS ZZ", "ISO8601"]
    target => "@timestamp"
  }
}
output {
  stdout{}
}

```

```auto
{
       "message" => "2020-07-14 10:41:24.879884 +05:30",
      "@version" => "1",
    "@timestamp" => 2020-07-14T05:11:24.879Z,
          "host" => "#####"
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 11, 2020, 12:30pm UTC](https://discuss.elastic.co/t/logstash-date-filter-and-timestamp/241110/5 "2020-08-11T12:30:39Z")

</div>

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