Splunk Search

How do I access to a value for event and event-1

psiek
New Member

Hi,

I need to display value (string) of a field depending on the value of this field in previous event.
Something like this :

if previous_event.field = "toto" then display current_event.field else display "anomaly"
I've found something interesting with "transatcion" by I can't achieve to do this.

Any help is welcome.

Thanks in advance.

Regards

0 Karma
1 Solution

jonuwz
Influencer

autoregress is going to be the simplests solution for you.

i.e.

 somesearch 
 | autoregress myfield as prev_myfield
 | eval display_field=if(prev_myfield=="toto",myfield,"anomoly")

if you need something more advanced than auoregress, streamstats allows you to do "by" clasuses etc.

View solution in original post

jonuwz
Influencer

autoregress is going to be the simplests solution for you.

i.e.

 somesearch 
 | autoregress myfield as prev_myfield
 | eval display_field=if(prev_myfield=="toto",myfield,"anomoly")

if you need something more advanced than auoregress, streamstats allows you to do "by" clasuses etc.

psiek
New Member

That does the trick, excellent ! Many thanks.

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...