Splunk Search

How to subtract filed values in a column

ezamit
Explorer

I have AWS Cloudtrail data and want to find out how long an EC2 instance was stopped. Is it possible to subtract the EpochOT from Row 3 to Row 2 and Row 5 to Row 4 etc..

 

ezamit_1-1706715500933.png

 

 

Labels (3)
0 Karma

ezamit
Explorer

😀Thanks Guys. it is working !!!!😀

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @ezamit ,

good for you, see next time!

let us know if we can help you more, or, please, accept one answer for the other people of Community.

Ciao and happy splunking

Giuseppe

P.S.: Karma Points are appreciated by all the contributors 😉

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @ezamit,

di you explored the delta command (https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/Delta)?

Ciao.

Giuseppe

0 Karma

ezamit
Explorer

Thanks @gcusello . That's a great suggestion.  I added | delta EpochOT p=1 to the search and it gave me the following results

ezamit_0-1706716488185.png

Is there a way we can do every other row in delta. I want Row 3 - Row 2, Row 5 - Row 4, Row 7 - Row 6 etc. Thanks again for your help 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @ezamit,

the solution from @ITWhisperer  is perfect!

Ciao.

Giuseppe

ITWhisperer
SplunkTrust
SplunkTrust
| eval "delta(EpochOT)" = if(NO % 2 = 0, null(), 'delta(EpochOT)')
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...