Splunk Search

Working with where clause

RamMur
Explorer

Hello, 

I'm fairly new to splunk, trying to search using where clause and filter the results. The query is running long, wondering if i'm not doin this right.

a tone down version of the search:

index=provisioning_index cf_org_name=abcd cf_app_name=xyz "ReconCount:"
|where jobNumber IN ([search index=provisioning_index cf_org_name=abcd cf_app_name=xyz operation="operation1" status=SUCCESS
|search NOT jobType="Canc"|table jobNumber
])
|stats count by deliveryInd
| addcoltotals
Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Ah, I should have expected that.  Try my revised query without IN.

---
If this reply helps you, Karma would be appreciated.

View solution in original post

RamMur
Explorer

Afte trying that , it errors out saying 

"Error in 'search' command: Unable to parse the search: Right hand side of IN must be a collection of literals. '((jobNumber = "3333") OR (jobNumber = "11111") . OR ..."

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Ah, I should have expected that.  Try my revised query without IN.

---
If this reply helps you, Karma would be appreciated.

richgalloway
SplunkTrust
SplunkTrust

The IN operator is not supported by the where command.  You can use IN with the search command or the in() function with the where command.  In this case, however, the IN is not needed if the subsearch is part of the base search (before the first pipe).

 

 

index=provisioning_index cf_org_name=abcd cf_app_name=xyz "ReconCount:"
jobNumber [search index=provisioning_index cf_org_name=abcd cf_app_name=xyz operation="operation1" status=SUCCESS
  |search NOT jobType="Canc"|table jobNumber
  ]
| stats count by deliveryInd
| addcoltotals

 

 

 

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...