Splunk Search

How to combine two queries into one?

dwibedi03
Explorer

I have two query that is exact same except the use of the lookup for each search. The one query includes data from a lookup and the other one excludes data from the same lookup. Is there a way I can combine two queries into one.

The first one is

 

index=abc dest="xyz.com" uri_path="access.html" http_method=POST NOT 
    [| inputlookup filter_ips 
    | fields src] | stats count by _time src

 

The second one is

 

index=abc dest="xyz.com" uri_path="access.html" http_method=POST 
    [| inputlookup filter_ips 
    | fields src] | stats count by _time src

 

The only difference is the Not in the first one. Can someone help me combine it? I tried using braces around the searches and combining it but didnt work.

Example

 

(index=abc dest="xyz.com" uri_path="access.html" http_method=POST NOT 
    [| inputlookup filter_ips 
    | fields src] | eval test= a1) OR (index=abc dest="xyz.com" uri_path="access.html" http_method=POST 
    [| inputlookup filter_ips 
    | fields src] | eval test=a2) | stats count by _time src test

 

But it gives error as eval expression malfunction.

Labels (4)
0 Karma

tscroggins
Influencer

The union of the two searches is simply the base search:

index=abc dest="xyz.com" uri_path="access.html" http_method=POST | stats count by _time src

0 Karma

to4kawa
Ultra Champion

If you combine them, you won't get any results.

0 Karma
Get Updates on the Splunk Community!

Splunk Observability Cloud’s AI Assistant in Action Series: Identifying Unknown ...

Agentic AI powers the Splunk AI Assistant within the Splunk Observability Cloud interface to help you quickly ...

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Splunk App for Anomaly Detection End of Life Announcement

Q: What is happening to the Splunk App for Anomaly Detection?A: Splunk is officially announcing the ...