Splunk Search

How to find deltas for multiple fields generically

benobviate
Explorer

Currently, the query ... | timechart span=1hr count by term limit=10

gives me

_time apple orange banana

3:00pm 123 138 100

4:00pm 132 102 129

Is there a way to find the deltas of each term without naming each individual field in the query? The reason is because the field names (terms) may change (there are several hundred possible terms).

I only know how to do ... | delta apple p=1 as apple_d

but unfortunately, the apple term might be something else. So I am hoping for soemthing like ... | delta all_fields_except_time* p=1 as field_name_d

Ultimately I want a table like _time apple_d orange_ d banana_d

0 Karma

jonuwz
Influencer

finally a use for untable. !

(not really - it you don't do timechart 1st, you wont be in this predicament )

... | untable _time fruit count | streamstats current=false window=1 global=false first(count) as p_count by fruit | eval delta=p_count-count | xyseries _time fruit delta

realistically, you would do the streamstats, manually calculate the delta, then do timechart on the delta field

martin_mueller
SplunkTrust
SplunkTrust

This will give the absolute delta, with no indication of which value is bigger:

... | streamstats range(*) window=2

The delta command does indeed not like wildcards.

Get Updates on the Splunk Community!

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...