Splunk Search

How do you find the same field values but are in two different fields?

HealyManTech
Explorer

I am trying to run a search to find the same field values will give me some results. An example would be if I wanted to see if an admin added himself to another group but it should have been someone else adding them. I am not sure how I would write something like that.

So something like if I have

field1=x and field2=y ignore 

field1=x and fielAny thoughts

Any thoughts?

0 Karma
1 Solution

elliotproebstel
Champion

If you just want to find events where the value in field1 matches the value in field2, that's very easy:

your base search that returns the events 
| where field1=field2

The where command will allow you to compare the values of the two fields.
http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Where

View solution in original post

0 Karma

elliotproebstel
Champion

If you just want to find events where the value in field1 matches the value in field2, that's very easy:

your base search that returns the events 
| where field1=field2

The where command will allow you to compare the values of the two fields.
http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Where

0 Karma

HealyManTech
Explorer

Worked thanks.

Just an FYI for anyone make sure you put that in before you table if you don't have those fields in your table command.

0 Karma

elliotproebstel
Champion

Good reminder for folks. Any transforming commands will potentially remove fields, so you must be careful to ensure you know which fields need to be preserved as you use them.

0 Karma
Get Updates on the Splunk Community!

Splunk Enterprise Security(ES) 7.3 is approaching the end of support. Get ready for ...

Hi friends!    At Splunk, your product success is our top priority. With Enterprise Security (ES), we're here ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...