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!

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...