Splunk Dev

AND STATMENTS - HOW DOES LIMIT THE DATA

J_Walker_Ex
New Member

Hi , I have just performed a search

Using Database and file path as the items

(DATABASE) (I:\LOCATION\AREA\UK). This returns 1000000 Results

I tried to QC my method by looking for the following

(DATA AND BASE) (I:\LOCATION\AREA\UK). This only returned 30000 Results. Which seems strange as I thought in theory this one should return all the DATABASE entries and any other occurrence of data and base. I am doing something obvious wrong ?

Tags (1)
0 Karma

woodcock
Esteemed Legend

In order for them to be similar, you need to use (DATA* AND *BASE). You would very much benefit from examining the lispy generated (the internal Splunk DB language) for each of your searches. Run a search, then after it is done, towards the right above the histogram is a Job menu. Click that and select Inspect job. This will open a new window with useful information, but not the lispy. At the top of this window is a search log link. Click that and search for lispy. Dig and learn.

0 Karma

skalliger
Motivator

Hi,

if I am correct, there is quite a difference here.
Searching for "database" will return events with the term "database". Whereas searching for DATA AND BASE will only return events with the terms data and base.
You would need to specify wildcards in order to get everything that contains the term data, like "*data*". "data*" etc.

Skalli

0 Karma

J_Walker_Ex
New Member

Hi thanks for you answer

But if I am searching for DATA and BASE does this not in theory mean that all the entries for DATABASE will be picked up by this search. As DATEBASE contains DATA and BASE

But this is not what I am seeing DATABASE is yelding more results the (DATA AND BASE)

if I have say a string like manchesteruniteduseDATAwhentheyareplayinggamestogiveaBASE

and I search for (DATA AND BASE) it not also going to pick it up

0 Karma

skalliger
Motivator

No, think of it like SQL (if you know this language).

If you search for something like this:

WHERE x LIKE "DATA" OR "BASE"

this will only return events where x = DATA or x = BASE, but it will NOT return events with x = DATABASE.

Because then, you would need to define wildcards, something like this:

WHERE x LIKE "DATA%" OR "%BASE"

So, searching for "base" AND "data" will not return database, if it is one term without a space.
Is it clearer now?

Searching for (DATA* AND *BASE) should return all the events you want.

Skalli

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!

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...

Upgrade Prep for 10.4, Network Observability Deep Dives, and More from Splunk Lantern

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

Splunk Developer Day announcements: AI agents, MCP tools, Forecasting, and Custom ...

Splunk Developer Day was packed with product and platform updates for developers building in the AI ...