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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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