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!

What the End of Support for Splunk Add-on Builder Means for You

Hello Splunk Community! We want to share an important update regarding the future of the Splunk Add-on Builder ...

Solve, Learn, Repeat: New Puzzle Channel Now Live

Welcome to the Splunk Puzzle PlaygroundIf you are anything like me, you love to solve problems, and what ...

Building Reliable Asset and Identity Frameworks in Splunk ES

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