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!

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...