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!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...