Splunk Search

Work out the duration between two fields

gracemaher
Explorer

Hi there.
I basically have a data set with Support Cases in, i would like to find out the duration between the case being created (New) and the case being closed (Resolved).

I have tried using eval/transaction and just cant get it to work.
can anyone help? 🙂
Thanks

Tags (2)
0 Karma

fdi01
Motivator

try

...| transaction Field_name startswith="New" endswith="Resolved"|eval duration = duration|...
0 Karma

woodcock
Esteemed Legend

The first answer using "stats" (not using "transaction") will be more effective (the max_span, etc. values are infinite) and also MUCH more efficient (quicker to run).

0 Karma

woodcock
Esteemed Legend

Let's say the field that you were using in your transaction command is "CorrelationField" then this should work:


... | stats earliest(_time) AS first latest(_time) AS last by CorrelationField | eval duration=last-first

Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...