Splunk Search
Highlighted

How to find deltas for multiple fields generically

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 allfieldsexcepttime* p=1 as fieldname_d

Ultimately I want a table like _time apple_d orange_ d banana_d

0 Karma
Highlighted

Re: How to find deltas for multiple fields generically

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.

Highlighted

Re: How to find deltas for multiple fields generically

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