Splunk Enterprise Security

Using the eval command, how do you calculate the time difference between two events WHERE the status value is different?

jacqu3sy
Path Finder

Hi,

There's probably a better function to use for this, but I think it could be done with an eval and where (I think anyway)...

I need to calculate the time difference between two events WHERE the status value is different. i.e;

event details          status         _time
event 1                       2              2019-03-25 00:01:00
event 2                       3              2019-03-25 00:31:00

I tried this, but it failed;

| eval time1=_time(where (like status="2")

any ideas?

0 Karma

nickhills
Ultra Champion

If there is something common between the events like a transaction_id you can use the 'transaction' statement, which calculates you a duration in ms.
https://docs.splunk.com/Documentation/Splunk/7.2.5/SearchReference/Transaction

...your search| transaction tx_id |eval dur_sec=round((duration/1000) ,0)

If you provide some more relevent data I can expand my example to fit your use case.

If my comment helps, please give it a thumbs up!
0 Karma

jacqu3sy
Path Finder

I didnt think about 'transaction', I'll take a look at that. Regarding data, I'm using the rule_id of an event taken from the enterprise security macro 'incident_review', which is common between the two events;

rule_id status AssignementTime
0FF72D78 2 1552985974.388964
0FF72D78 3 1552986403.234565

0 Karma

nickhills
Ultra Champion

Great, just try swapping 'tx_id' for 'rule_id' and see how that fits your needs.
Good luck!

If my comment helps, please give it a thumbs up!
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Think Like an Architect: Introducing the Splunk Certified Cybersecurity Defense ...

In cybersecurity, defenders respond to threats. Architects design the systems that stop them.    As ...

Best Practices: Splunk auto adjust pipeline queue

When you enable autoAdjustQueue in Splunk, maxSize should be understood as the queue size Splunk starts with ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...