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!

Enhance Your Splunk App Development: New Tools & Support

UCC FrameworkAdd-on Builder has been around for quite some time. It helps build Splunk apps faster, but it ...

Prove Your Splunk Prowess at .conf25—No Prereqs Required!

Your Next Big Security Credential: No Prerequisites Needed We know you’ve got the skills, and now, earning the ...

Splunk Observability Cloud's AI Assistant in Action Series: Observability as Code

This is the sixth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...