# Logstash date filter for @timestamp and conversion

**URL:** https://discuss.elastic.co/t/logstash-date-filter-for-timestamp-and-conversion/195368
**Category:** Logstash
**Created:** [August 15, 2019, 3:59pm UTC](https://discuss.elastic.co/t/logstash-date-filter-for-timestamp-and-conversion/195368 "2019-08-15T15:59:26Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![griffer98](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@griffer98](https://discuss.elastic.co/u/griffer98)
#### Post date: [August 15, 2019, 3:59pm UTC](https://discuss.elastic.co/t/logstash-date-filter-for-timestamp-and-conversion/195368/1 "2019-08-15T15:59:26Z")

</div>

I currently have a field called time which has a the time my file was created in this format: dd-MM-yyyy\_HHmmss. I would like to change the @timestamp to be the the time of file creation(time from my time field) instead of time it was read into logstash.

This is my date filter

```
     date
  {
    match => ["Time" , "dd-MM-yyyy_HHmmss"]
    target => "@timestamp"
  } 

```

I get a dateparsefailure. How do I get the date filter to change the timestamp not only to my new time but also convert the format something different?

---

<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 15, 2019, 4:27pm UTC](https://discuss.elastic.co/t/logstash-date-filter-for-timestamp-and-conversion/195368/2 "2019-08-15T16:27:16Z")

</div>

What does the [Time] field look like if you use this?

```
output { stdout { codec => rubydebug { } } }

```

In elasticsearch timestamps are stored as the number of milliseconds since the epoch. You can change the display format in Kibana. If you want to store a different string format you can use [ruby](https://discuss.elastic.co/t/converting-a-date-input-as-a-string-into-a-new-format/177498).

---

<div class="post-metadata">

### Author: ![griffer98](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@griffer98](https://discuss.elastic.co/u/griffer98)
#### Post date: [August 15, 2019, 4:30pm UTC](https://discuss.elastic.co/t/logstash-date-filter-for-timestamp-and-conversion/195368/3 "2019-08-15T16:30:46Z")

</div>

Time looks like this: 03-DEC-2017\_140455  
I want to convert it into ISO format and make it the @timestamp

---

<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 15, 2019, 5:21pm UTC](https://discuss.elastic.co/t/logstash-date-filter-for-timestamp-and-conversion/195368/4 "2019-08-15T17:21:31Z")

</div>

```
date { match => ["Time", "dd-MMM-YYYY_HHmmss"] }

```

MM matches numeric month 01-12. MMM matches the abbreviated name.

---

<div class="post-metadata">

### Author: ![griffer98](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@griffer98](https://discuss.elastic.co/u/griffer98)
#### Post date: [August 15, 2019, 5:33pm UTC](https://discuss.elastic.co/t/logstash-date-filter-for-timestamp-and-conversion/195368/5 "2019-08-15T17:33:15Z")

</div>

Thank you! That was the problem

---

<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 12, 2019, 5:33pm UTC](https://discuss.elastic.co/t/logstash-date-filter-for-timestamp-and-conversion/195368/6 "2019-09-12T17:33:19Z")

</div>

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