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!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...