I have a field in ES which holds timestamp like below:
Nov 30,14:49:56.785 INFO Plane 1A landed
Nov 30,14:49:57.099 INFO Plane 2B landed
Nov 30,14:49:57.368 INFO Plane 2C landed
Nov 30,14:49:57.620 INFO Plane 2D landed
Nov 30,14:49:57.900 INFO Plane 5X landed
Nov 30,14:49:58.267 INFO Plane 6G landed
I need the difference between the alternate occurrence.
Ex:
diff13 = Nov 30,14:49:57.368 - Nov 30,14:49:56.785 ( = 583ms)
diff24 = Nov 30,14:49:57.620 - Nov 30,14:49:57.099 ( = 521ms)
Any help in getting this done using scripted fileds in Kibana? Thanks.
Thanks for your response, After reading your reply, I would prefer to do it in logstash itself.
I think my original question was not clear enough, I have updated the log lines for clarity. Assume, that is how the log lines appear. I need the difference of the timestamps mentioned in the loglines(alternate) .
I do not know Ruby, but what I understood is that the code above will give the actual time difference between the log events. Please correct me if i am wrong.
For debugging my filters I created two filters in logstash.
The first filter which is processed creates a field logstash.processing.filterStart with the current time.
The last filter which is processed contains the part I posted above. It creates a new field logstash.processing.filterEnd and it calculates the time difference between these two fields, which are both stored in the same event.
For your example as I understand you have multiple events = log lines and you want to diff between them.
How this works, I just want to know by myself, but unfortunately I don't.
In my case both timestamps are fields in the same event which was created out of a single log line.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.