Other Usage

splunk query

numeroinconnu12
Path Finder

Hello,
Thank you in advance for your help.
I have a query that returns results containing a list of names and another query that also returns a list containing names.
I would like to make a report indicating the names present in the first query but not present in the second query (delta of both queries)

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

There are a couple of ways to do this and it depends on your searches and data. Ideally, you can easily identify where each event comes from by something like index or sourcetype and the field names for the name field are the same in both sources. Try something like this

(index=source1 sourcetype=sourcetype1) OR (index=source2 sourcetype=sourcetype2)
| stats values(sourcetype) as sourcetype by name
| where sourcetype=sourcetype1 AND mvcount(sourcetype)==1

 

0 Karma

numeroinconnu12
Path Finder

Hello @ITWhisperer , thanks foy your answer

for more information:

query 1:
index=active_directory
| stats count by cn
|rename cn as name

Results:
name
test
test1
test2
test3

query 2:
index=cabod
| stats count by name

Results
name
test1
test2


So I would like a query that shows me what is present in the results of query 1 but not in the results of query 2. in this case test, test3

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
index=active_directory OR index=cabod
| eval name=coalesce(name, cn)
| stats count by name
0 Karma
Get Updates on the Splunk Community!

Splunk Platform | Upgrading your Splunk Deployment to Python 3.9

Splunk initially announced the removal of Python 2 during the release of Splunk Enterprise 8.0.0, aiming to ...

From Product Design to User Insights: Boosting App Developer Identity on Splunkbase

co-authored by Yiyun Zhu & Dan Hosaka Engaging with the Community at .conf24 At .conf24, we revitalized the ...

Detect and Resolve Issues in a Kubernetes Environment

We’ve gone through common problems one can encounter in a Kubernetes environment, their impacts, and the ...