Splunk Search

Equivalent timechart correlation query without subsearch

dzhangw7
New Member

Can someone help create an equivalent query to the following, without using subsearch? There are probably too many results and the query does not complete.

 

index=my_index 
[search index=my_index ("Extracted entities" AND "'date': None") OR extracted_entities.date=null | stats count by entity_id | fields entity_id | format]
"Check something" | timechart count by classification

 

Basically I want to extract the list of entity_ids from this search: [search index=my_index ("Extracted entities" AND "'date': None") OR extracted_entities.date=null] where dates are null and then use those IDs to correlate in a second search "Check something" which has a field "classification", and then I want to do a timechart on the result to see a line graph of events where a date was missing from an event, plus with a given classification.

Labels (4)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

As @gcusello already pointed out - if your subsearch reaches to the same index as the outer search, it's pointless to do it this way. Limiting the base search is enough.

But if you want to correlate events from two different indexes, you'd need to search from both indexes at the same time (join conditions with OR) and then do some stats by common field.

Anyway,

| stats count by entity_id | fields entity_id

doesn't make much sense. It's enough to do

| stats values(entity_id) as entity_id

 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @dzhangw7 ,

why are you using a subsearch?

you can put all the conditions in the main search:

index=my_index "Check something" (("Extracted entities" AND "'date': None") OR extracted_entities.date=null)
| timechart count by classification

eventually adding a condition on identity_id

index=my_index "Check something" (("Extracted entities" AND "'date': None") OR extracted_entities.date=null) identity_id=*
| timechart count by classification

Ciao.

Giuseppe

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...