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

(Gautam) #1

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.

(system) #2

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