Splunk Search

How to add 2 different fields with under the same function?

Abarny
Path Finder

Hi guys,

I need to do add enter 2 different fields under the same function. The first is with an ACResponse specific and i need to respect this function because I will take more information I want just different ACReponse 200

| stats list(ACResponse) as ACResponse by OCId 
| search ACResponse!="*200*"
|eval ACResponse=mvjoin(ACResponse,";")
| stats count(ACResponse) 

But i need to research too result Workflow="debordement_*", ACresponse for debordement doesn't exist (null) and add to the first result :
search:

Workflow="debordement_*" 
               |stats dc(OCId)

I tried with that but the result is null .. Can you tell me what is wrong please and help me if you know how.

  Workflow="*tsr*" OR "go_choix_1*"  
|stats count(OCId) 
| where Workflow="debordement_*" 
[| stats list(ACResponse) as ACResponse by OCId | search ACResponse!="*200*"|eval ACResponse=mvjoin(ACResponse,";")| stats count(ACResponse) as ACResponse]

Thanks for your answers.

0 Karma

woodcock
Esteemed Legend

Right now your search is doing nothing but counting the unique values of OCId which can be done like this:

... | stats dc(OCId)
0 Karma

adayton20
Contributor

Alright... I THINK I understand what you're trying to do. Maybe.

I think you're trying to join two searches based on a common field.

If that's the case, try something like this:

YourSearch Workflow="*tsr*" OR "go_choix_1*" 
| eval ACResponse=mvjoin(ACResponse,";") 
| search ACResponse!="*200*" 
| join OCId type=outer 
    [ AnotherSearch Workflow="debordement_*" 
    | stats count by OCId] 
| stats list(ACResponse) AS ACResponse, dc(ACResponse) AS ACResponse_dcount by OCId

You're doing a few different things with the stats functions in your searches, so I'm not sure exactly what your expected output is. You might need to explain a little more. Otherwise, I hope that helps.

0 Karma

Abarny
Path Finder

Yes, I want add this 2 differents search for give a unique number. Currently I can find every two but regardless and I want regroup for have A + B.

I try with your solution but I find only responses different of 200 and not the call by the Workflow "debordement_*"

1.      MySearch Workflow="*tsr*" OR "go_choix_1*" 
2.  | stats list(ACResponse) as ACResponse by OCId
3.   | search ACResponse!="*200*" 
4.   | eval ACResponse=mvjoin(ACResponse,";")
5.   | join OCId type=outer  [ search Workflow="debordement_*" 
6.   | stats count by OCId] 
7.   | stats list(ACResponse) AS ACResponse, dc(ACResponse) AS ACResponse_dcount by OCId
8.   | stats count(ACResponse_dcount ) 
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!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...