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!

Observability Unlocked: Kubernetes Monitoring with Splunk Observability Cloud

 Ready to master Kubernetes and cloud monitoring like the pros? Join Splunk’s Growth Engineering team for an ...

Update Your SOAR Apps for Python 3.13: What Community Developers Need to Know

To Community SOAR App Developers - we're reaching out with an important update regarding Python 3.9's ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...