Splunk Search

NOT Inputlookup not working

willadams
Contributor

I am trying to perform a search and trying to add an inputlookup to filter information I don't need to know about. For example if I run the following query

index=firewall NOT [|inputlookup agent-inclusion-knownapps
| where NOT cidrmatch("x.x.x.x/x",dest_ip) AND NOT cidrmatch("y.y.y.y/y",dest_ip)
| fields agent]
| stats count by agent
| sort -count

This produces a result and the logs filter correctly (proved by removing NOT and only seeing the entries from the inputlookup; and adding the NOT and not seeing the entries from the inputlookup).

However if I then try to extend my query with the following it no longer filters and I am not sure where I have gone wrong. The query is as follows:

index=firewall "destination network"=external NOT(action=blocked) NOT [|inputlookup agent-inclusion-knownapps | where NOT cidrmatch("x.x.x.x/x",dest_ip) AND NOT cidrmatch("y.y.y.y/y",dest_ip)
| fields agent]
| stats count by agent username src dest dest_port rule action
| sort -count

Tags (1)
0 Karma

HiroshiSatoh
Champion

I think the search sentence is not wrong.
Please check the search sentence in the search log of the INSPECT JOB to see if it is the intended search sentence.

0 Karma

willadams
Contributor

The inclusion file for reference purposes is configured as:

agent

"applicationx.exe"

The file permissions are correct and the lookup is a tabled definition referencing the csv file.

0 Karma

Shan
Builder

@ willadams

So your saying, by adding the below code your query is not working.
If that is the scenario give a try like this.
I'm not sure it will work, but this is my suggestion..

"destination network"=external NOT(action=blocked)

"destination network" --> I believe this is a value.
external --> I Hope this is a field
try this

Index=***
"destination network"=external NOT action IN("blocked")

If "destination network" is a filed then try this

 Index=***
    | rename "destination network" as destination_network
    destination_network=external NOT action IN("blocked")
0 Karma

willadams
Contributor

Even if I omit the "destination network" the results still end up the same. For example if I run this

index=firewall NOT [|inputlookup agent-inclusion-knownapps | where NOT cidrmatch("x.x.x.x/x",dest_ip) AND NOT cidrmatch("y.y.y.y/y",dest_ip)
| fields agent]
| stats count by agent username src dest dest_port rule action
| sort -count

However I did try and remove the NOT from just before " [|inputlookup" and found that I am only getting 1 result. It looks as though SPLUNK is not referencing my lookup properly.

0 Karma

willadams
Contributor

For example my lookup file shows as (ignore the *)


agent

"application1.exe"
"application2.exe"
"application3.exe"
"application11.exe"
"application22.exe"
"application33.exe"


If I look at the data currently being referenced I get "application1.exe" and cannot see application2.exe; application3.exe etc. it only references application1.exe

0 Karma
Get Updates on the Splunk Community!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...