# Date filter with nano seconds

**URL:** https://discuss.elastic.co/t/date-filter-with-nano-seconds/80004
**Category:** Logstash
**Created:** [March 25, 2017, 6:41pm UTC](https://discuss.elastic.co/t/date-filter-with-nano-seconds/80004 "2017-03-25T18:41:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Toontje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/toontje/32/16100_2.png) [@Toontje](https://discuss.elastic.co/u/Toontje)
#### Post date: [March 25, 2017, 6:41pm UTC](https://discuss.elastic.co/t/date-filter-with-nano-seconds/80004/1 "2017-03-25T18:41:04Z")

</div>

Hi all!

I have a date filed in UNIX format, but not up to the microsecond, but up to the nano second. Example: 1448482607735645  
For the date filter to get a decent date out of this i need to divide the content of the date field by 1.000.000.  
How do i do this in Logstash?

Thanks,

Ton.

---

<div class="post-metadata">

### Author: ![Toontje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/toontje/32/16100_2.png) [@Toontje](https://discuss.elastic.co/u/Toontje)
#### Post date: [March 25, 2017, 7:23pm UTC](https://discuss.elastic.co/t/date-filter-with-nano-seconds/80004/2 "2017-03-25T19:23:52Z")

</div>

No worries. Have it.

```
  ruby {
        code => "event.set('unixdate',event.get('microseconds').to_i / 1000)"
    }
    date {
        match => ["unixdate", "UNIX_MS"]
    }
```

---

<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: [April 22, 2017, 7:24pm UTC](https://discuss.elastic.co/t/date-filter-with-nano-seconds/80004/3 "2017-04-22T19:24:03Z")

</div>

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