# To create a date field in logstash

**URL:** https://discuss.elastic.co/t/to-create-a-date-field-in-logstash/175364
**Category:** Logstash
**Created:** [April 4, 2019, 9:29am UTC](https://discuss.elastic.co/t/to-create-a-date-field-in-logstash/175364 "2019-04-04T09:29:52Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sagarleo](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@sagarleo](https://discuss.elastic.co/u/sagarleo)
#### Post date: [April 4, 2019, 9:29am UTC](https://discuss.elastic.co/t/to-create-a-date-field-in-logstash/175364/1 "2019-04-04T09:29:52Z")

</div>

I'm trying to create a date field using logstash filter . The field i created extracts time part from logs but when trying to visualize in kibana as date histograms. This newtimestamp field i created in logstash do not appear.  
I am using elk 6.6.2 version and filebeat version 6.2.1  
Here are the screenshots.

 ![11a](https://us1.discourse-cdn.com/elastic/original/3X/d/6/d6666cf320ffc5261bd714e7b29107c34abea94e.png)  
 ![11b](https://us1.discourse-cdn.com/elastic/original/3X/4/6/4685b7140486ba59e6cef17d4b1cc7fdd5868389.png)  
Below is my logstash filter config file.

```auto
input {
  beats {
    port => "5044"
  }
}
# The filter part of this file is commented out to indicate that it is
# optional.
filter {
grok {
    match => ["message", "%{TIMESTAMP_ISO8601:newtimestamp} %{GREEDYDATA:message}"]
  }

date {
    match => ["newtimestamp", "YYYY-MM-dd HH:mm:ss.SSS"]
    target => "newtimestamp"
  }
}
output {
    elasticsearch {
        hosts => ["http://localhost:9200"]
        index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
    }
        stdout {codec => rubydebug}
}

```

Please help me on this Sir/Ma'am.

---

<div class="post-metadata">

### Author: ![BKG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bkg/32/43591_2.png) [@BKG](https://discuss.elastic.co/u/BKG)
#### Post date: [April 6, 2019, 8:55am UTC](https://discuss.elastic.co/t/to-create-a-date-field-in-logstash/175364/2 "2019-04-06T08:55:33Z")

</div>

You might need to add it in the Kibana index template.

---

<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: [May 4, 2019, 9:05am UTC](https://discuss.elastic.co/t/to-create-a-date-field-in-logstash/175364/3 "2019-05-04T09:05:41Z")

</div>

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