Splunk Search

How could I dynamically exclude events from search results?

bpitts2
Path Finder

Hello All,

I'm working on a new query for one of our SIP (VoIP) dashboards. In the SIP world, each call has a unique call ID called the SIP Call ID. Due to the way that our fail-over devices work, we'll see 'phantom' calls on our back-up server because the phones consistently try to register to the backup device.

I'm able to filter the majority of these messages by simply excluding the word "REGISTER" in my current search. However, there are still some false-positive results because of the response messages that are returned by the fail-over device. Both the SIP Call ID and message type are extracted as their own fields.

I would like to build a query that if it finds an event with the message type "REGISTER", it would then exclude all messages with the associated SIP Call IDs.

So far I've managed this:

index=sbc_pci "sipmsg.log" sipmessage="REGISTER" | stats values(call_id) as badcallid | mvexpand badcallid

Which has given me a nice list of the sip call IDs that I want to exclude. I just need some help understanding how I pipe this to a sub search as a "NOT".

Perhaps something like:

index=sbc_pci "sipmsg.log" sipmessage="REGISTER" | stats values(call_id) as badcallid | mvexpand badcallid | search index=sbc_pci "sipmsg.log" NOT badcallid

So close, but I'm not able to connect all the dots.

Thanks!

0 Karma

MuS
SplunkTrust
SplunkTrust

Hi bpitts2,

without knowing too much about your events; try this negative sub search:

your base search here | search NOT [ search index=sbc_pci "sipmsg.log" sipmessage="REGISTER" | stats values(call_id) as badcallid | mvexpand badcallid ]

But be aware of the sub search limits http://docs.splunk.com/Documentation/Splunk/6.3.0/Search/Aboutsubsearches#Subsearch_performance

Hope this helps ...

cheers, MuS

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...