Splunk Search

How do you compare a field value with another field in the following event?

ben_leung
Builder

Example data:

From:                  To:
1. www.google.com      www.google.com/123
2. www.yahoo.com        www.yahoo.com/567
3. www.yahoo.com/567    www.google.com
4. www.splunk.com       www.splunk.com/login

How would you compare the "From:" field second event" with the "To:" field value in the third event?

I want to just display the events that have values that are the same in the preceding event. That can be done probably with and eval, but I would first have to be able to compare values from different events and different fields.

My final results would be like the example but only display events two and three.

1 Solution

somesoni2
Revered Legend

Try this

Your base search giving above two fields From and To | streamstats current=f window=1 last(From) as prevFrom 

This should give you From value from 2nd row in the 3rd with name prevFrom, which can be used to filter.

View solution in original post

somesoni2
Revered Legend

Try this

Your base search giving above two fields From and To | streamstats current=f window=1 last(From) as prevFrom 

This should give you From value from 2nd row in the 3rd with name prevFrom, which can be used to filter.

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 ...