# Get timestamp, date and time fields in date format in logstash

**URL:** https://discuss.elastic.co/t/get-timestamp-date-and-time-fields-in-date-format-in-logstash/85020
**Category:** Logstash
**Created:** [May 9, 2017, 6:50am UTC](https://discuss.elastic.co/t/get-timestamp-date-and-time-fields-in-date-format-in-logstash/85020 "2017-05-09T06:50:30Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![gautamv](https://avatars.discourse-cdn.com/v4/letter/g/ecccb3/32.png) [@gautamv](https://discuss.elastic.co/u/gautamv)
#### Post date: [May 9, 2017, 6:50am UTC](https://discuss.elastic.co/t/get-timestamp-date-and-time-fields-in-date-format-in-logstash/85020/1 "2017-05-09T06:50:30Z")

</div>

I'm trying to plot date histograms in kibana 5 for each day. Therefore, I want the x-axis to be just the time. Right now, I have a `@timestamp` field, which has the datetime captured as `2017-04-17T20:12:47.221Z`. I'm capturing it from a timestamp field in a csv file, which looks like this:`[4/17/17 20:12:47:221]`.

This is my current logstash config code which takes data from a csv file:

```
filter {
if [type] == "Error_file" {
    csv {
            columns => ["timestamp", "message"]
    }
    date {
            match => ["timestamp", "[M/dd/yy HH:mm:ss:SSS]"]
            add_field => { "Date" => "%{+M/dd/yy}" }
            add_field => { "Time" => "%{+HH:mm:ss:SSS}" }
    }
}
}

```

However, the date and time are getting captured as string and I'm not able to plot the date histogram. If there is a way in Kibana to directly plot the above histogram without capturing data and time separately, I can work with that too.

Have just started using the ELK stack so I would appreciate if you can provide some explanation along with the answer.

Thanks in advance.

---

<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: [June 6, 2017, 7:02am UTC](https://discuss.elastic.co/t/get-timestamp-date-and-time-fields-in-date-format-in-logstash/85020/2 "2017-06-06T07:02:16Z")

</div>

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