Splunk Search

how i can compare last 5 fields and exclude from result

saghiralmani
New Member

i want to compare if last 5 digits of user ID are same don't show in result
how it can be done

0012345
abc0012345
xyx\0012345

if the resulting values are above as a user ID, i want to check if last 5 values(12345) are same so it should not trigger in my search as a result of user ID

Tags (1)
0 Karma

harishalipaka
Motivator

hi @saghiralmani

base search . . .. |eval test=substr(user_id_field,-5) |eventstats  count by test |where count > 1
Thanks
Harish
0 Karma

renjith_nair
Legend

@saghiralmani ,

If you want to compare the extracted IDs against another value, try

|rex field=your_user_id_field "(?<extracted_id>\d{5}$)"

OR

|eval extracted_id=substr(your_user_id_field,-5)

Compare extracted_id against with the value

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
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 ...