# Logstash date filter convert @timestamp to timestamp in log file issue

**URL:** <https://discuss.elastic.co/t/logstash-date-filter-convert-timestamp-to-timestamp-in-log-file-issue/196100>\
**Category:** Logstash\
**Created:** [August 21, 2019, 12:01pm UTC](https://discuss.elastic.co/t/logstash-date-filter-convert-timestamp-to-timestamp-in-log-file-issue/196100 "2019-08-21T12:01:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dcrocker](https://avatars.discourse-cdn.com/v4/letter/d/aca169/32.png) [@dcrocker](https://discuss.elastic.co/u/dcrocker)\
**Post date:** [August 21, 2019, 12:01pm UTC](https://discuss.elastic.co/t/logstash-date-filter-convert-timestamp-to-timestamp-in-log-file-issue/196100/1 "2019-08-21T12:01:22Z")

</div>

I am trying to convert the log file time stamp to @timestamp, but it is not working.

Following is the date in the job log:  
"2019-08-20T11:52:18.4906519-04:00"

Following is the date filter:  
date { # use timestamp from the log  
match =\> ["timeStamp", "yyyy-MM-dd'T'HH:mm:ss.SSSZZ"] #"2019-08-20T11:52:18.4906519-04:00"  
target =\> "@timestamp"  
}

I believe the issue is with the format, I have tried many but none seem to work.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [August 21, 2019, 12:35pm UTC](https://discuss.elastic.co/t/logstash-date-filter-convert-timestamp-to-timestamp-in-log-file-issue/196100/2 "2019-08-21T12:35:27Z")

</div>

If you have seven digits after the decimal in your timeStamp you need seven S to match

```
date { match => ["timeStamp", "yyyy-MM-dd'T'HH:mm:ss.SSSSSSSZZ"] }
```

---

<div class="post-metadata">

**Author:** ![dcrocker](https://avatars.discourse-cdn.com/v4/letter/d/aca169/32.png) [@dcrocker](https://discuss.elastic.co/u/dcrocker)\
**Post date:** [August 21, 2019, 2:49pm UTC](https://discuss.elastic.co/t/logstash-date-filter-convert-timestamp-to-timestamp-in-log-file-issue/196100/3 "2019-08-21T14:49:18Z")

</div>

Thanks Badger, that worked. Thought I tried that, but guess not.

---

<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:** [September 18, 2019, 2:49pm UTC](https://discuss.elastic.co/t/logstash-date-filter-convert-timestamp-to-timestamp-in-log-file-issue/196100/4 "2019-09-18T14:49:20Z")

</div>

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