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!

Where Innovation Takes Flight: The Splunk4Aviation Flight Sim Lands at .conf26

If you hear someone at .conf26 shouting "gear down, GEAR DOWN" across the show floor, you have found us.  The ...

Turn Cisco Telemetry Into Action with Cisco Data Fabric, powered by the Splunk ...

The surge in machine data is already hitting enterprise budgets, and the agentic era will only intensify it. ...

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...