Splunk Search

Compound Search with two sourcetypes

hartfoml
Motivator

I want to search for an IDS event like this

sourcetype=IDS "MALWARE-CNC"

Then I want to use the src_IP and dst_IP to search the proxy logs to see if the proxy blocked the traffic. Something Like this I would think

sourcetype=IDS "MALWARE-CNC" | fields src_ip dst_ip [ search sourcetype=proxy src_ip dst_ip action!=DENIED]
Tags (3)
0 Karma

jonuwz
Influencer

nearly : )

sourcetype=proxy action!=DENIED [ search sourcetype=IDS "MALWARE-CNC" | fields src dst | dedup src dst | rename src as src_ip dst as dst_ip ]

Edit missed out "search" in the sub search

0 Karma

jonuwz
Influencer

whoops - updated answer ....

0 Karma

hartfoml
Motivator

Nick thanks for the help. Here is the search I used

sourcetype="bcoat_proxysg" action!=TCP_DENIED [ sourcetype=IDS "MALWARE-CNC" | fields src dst | dedup src dst | rename src as src_ip dst as dst_ip ]

I get this error "Search operation 'sourcetype' is unknown. You might not have permission to run this operation."

0 Karma

theouhuios
Motivator

rename should do that.

0 Karma

sideview
SplunkTrust
SplunkTrust

Assuming it's dst and dst_ip on the destination side, it's as follows:

sourcetype=proxy action!=DENIED [ sourcetype=IDS "MALWARE-CNC" | fields src dst | dedup src dst | rename src as src_ip dst as dst_ip ]

0 Karma

hartfoml
Motivator

Also using the transforms I have in right now the IDS uses "src" for the source IP and the proxy uses "src_ip".

How would I right the search to convert the IP from one tag to another for the subsearch?

0 Karma

sideview
SplunkTrust
SplunkTrust

When a subsearch is processed, it's the inner subsearch that is run first, so in jonuwz's example, the malware-cnc search is processed first, and it's only the src and dest ip's of the malware search IP's that are then searched for in the proxy data.

0 Karma

hartfoml
Motivator

If I get the IDS alert and it is not denied by the proxy then an exploit is at hand. If the traffic is denied I can look at it later and don't need the alert right now.

So the !DENIED will generate an event that I can alert on.

0 Karma

theouhuios
Motivator

If you are looking for just one, then why use "NOT DENIED"? Instead you can use that same value to search on. Try to create your searches in as positive as possible manner. It will help in performance.

0 Karma

hartfoml
Motivator

So why do I put the proxy search first? there are lots of "Not DENIED" logs to look through and I am only looking for one. Why not find the IP in IDS and pass to the proxy search?

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!

May 2026 Splunk Expert Sessions: Security & Observability

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

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...