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!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

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