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!

What the End of Support for Splunk Add-on Builder Means for You

Hello Splunk Community! We want to share an important update regarding the future of the Splunk Add-on Builder ...

Solve, Learn, Repeat: New Puzzle Channel Now Live

Welcome to the Splunk Puzzle PlaygroundIf you are anything like me, you love to solve problems, and what ...

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...