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 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...