Splunk Search

How to compare values from 2 different rows?

efaundez
Path Finder

Good afternoon

could someone help me with this query:

I have the following values

| users | Age |
  user1 | 99
  user2 | 99

How can I compare that if the user user1 of age 99 is equal to the user of age 99, then OK?

The field that has these users is called user and age has the values for each user

Any help is appreciated

Regards

Tags (1)
0 Karma

adonio
Ultra Champion

maybe try something like this:

| makeresults count=1
| eval user="bob,rob,todd,jon,max,ben"
| makemv delim="," user
| mvexpand user
| eval age = random()%4
| stats values(user) as all_users_with_same_age by age
| eval OK = if(mvcount(all_users_with_same_age) > 1,"OK","NOT OK")

hope it helps

0 Karma

jacobpevans
Motivator

Can you further clarify? Are you comparing user1=user2 or age of user1 = age of user2? What does OK mean?

Cheers,
Jacob

If you feel this response answered your question, please do not forget to mark it as such. If it did not, but you do have the answer, feel free to answer your own post and accept that as the answer.
Get Updates on the Splunk Community!

Celebrating Fast Lane: 2025 Authorized Learning Partner of the Year

At .conf25, Splunk proudly recognized Fast Lane as the 2025 Authorized Learning Partner of the Year. This ...

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...