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!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...