I would like to get the execution time of each command, that means I should calculate the difference between two successive timestamps. I tried to use the elapsed plugin, but nothing is displayed in output.
Is there any other way to do this?
Assuming that each event has a [timestamp] field with a value like "1612778642014" I would do this in a ruby filter. You will need to set pipeline.workers to 1 and make sure pipeline.ordered is true (which it is by default in 7.x when pipeline.workers is 1)
ruby {
code => '
ts = event.get("timestamp").to_i
if ts
if @lastTimestamp
event.set("duration", ts - @lastTimestamp)
end
@lastTimestamp = ts
end
'
}
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.