Splunk Enterprise Security

How to exclude IPs from results while using Tstats and a sourcetype that is not the same?

aminfosec
New Member

Current search is essentially this:

| tstats values(All_Traffic.src) as src
    from datamodel=Network_Traffic.All_Traffic
    by All_Traffic.dest
| lookup mythreatlist IOC as dest OUTPUTNEW list
| list=*
| search NOT whitelistedSources
| search NOT whitelistedDestinations

The tstats model uses a sourcetype the returns logs that do not have the URL in them, only destination IP. This cannot change. A second sourcetype, stURL, does have the URLs. I am looking for a way to use a subsearch/join so that I can exclude all source IPs where the URL is splunkdotcom, even if the IP for splunkdotcom is on my threat list.

I have tried to create the subsearch

[search index=A sourcetype=stURL url="*splunkdotcom*" | fields src]

to obtain all source IPs that visited splunk.com and then exclude them from my tstats search but it does not appear to be working as intended.

0 Karma

woodcock
Esteemed Legend

Try this:

|tstats values(All_Traffic.src) as src 
FROM datamodel=Network_Traffic.All_Traffic
WHERE NOT [search index=A sourcetype=stURL url="*splunkdotcom*" | fields src | rename src AS "All_Traffic.src"]
BY All_Traffic.dest
...
0 Karma

jkat54
SplunkTrust
SplunkTrust

Your subsearch is very close to being what you want.

You'll need to add

| format 

or

| return src

To your subsearch depending on how you want the subsearch to work. In this case | return seems the most appropriate

See the docs for format and return as needed.

0 Karma

jkat54
SplunkTrust
SplunkTrust

alt text

0 Karma

woodcock
Esteemed Legend

Right, but it does that anyway, you just don't get to see it.

0 Karma

woodcock
Esteemed Legend

I don't think you said what you meant to say. Adding | format will change absolutely nothing about the effect of the subsearch other than readability.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...