Splunk Search

How to combine multiple chart queries into one?

VikhyathMaiya
Explorer

Hello splunk community. As on today we have two queries that are running 

Count of api grouped by apiName and status

 

 

index=aws* api.metaData.pid="myAppName"
| rename api.p as apiName
| chart count BY apiName "api.metaData.status"
| multikv forceheader=1
| table apiName success error NULL

 

Which displays a table something like shown below
=====================================
| apiName            || success || error              || NULL.   |
====================================
| Test1                   || 10            || 20.                  || 0            |
| Test2                   || 10            || 20.                  || 0            |
| Test3                   || 10            || 20.                  || 0            |
| Test4                   || 10            || 20.                  || 0            |
| Test5                   || 10            || 20.                  || 0            |
| Test6                   || 10            || 20.                  || 0            |

latency of api grouped by apiName

 

index=aws* api.metaData.pid="myAppName" 
| rename api.p as apiName 
| rename api.measures.tt as Response_Time 
| chart min(Response_Time) as RT_fastest max(Response_Time) as RT_slowest by apiName
| table apiName RT_fastest RT_slowest

 

which displays a table something like below

==================================
| apiName            || RT_fastest || RT_slowest              
==================================
| Test1                   || 10                  || 20.                  |
| Test2                   || 10                  || 20.                  |
| Test3                   || 10                  || 20.                  |
| Test4                   || 10                  || 20.                  |
| Test5                   || 10                  || 20.                  |
| Test6                   || 10                  || 20.                  |


Question:

If you see the above tables, both tables are grouped with apiName. Is there a way to combine these queries so that i get a single result something like this

|===============================================
| apiName || success || error || NULL || RT_fastest. || RT_slowest |
===============================================
| Test1       || 10            || 20.     || 20.       || 20.                  || 20.                  ||
| Test2       || 10            || 20.     || 20.       || 20.                  || 20.                  ||
| Test3       || 10            || 20.     || 20.       || 20.                  || 20.                  ||
| Test4       || 10            || 20.     || 20.       || 20.                  || 20.                  ||
| Test5       || 10            || 20.     || 20.       || 20.                  || 20.                  ||
 
I could not find any documentation regarding combining multiple chart query into one. Could someone please help me with this. Thanks 🙂


Labels (6)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

This is essentially the same problem as has been answered here https://community.splunk.com/t5/Splunk-Search/Appending-tp99-as-a-new-column-in-the-existing-query/m... You have to do the stats which are aggregated by apiName first and concatenate it to the apiName, then do the stats which are aggregated by apiName and status, then split out the stats which were aggregated by just apiName

0 Karma
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!

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Maximizing the Value of Splunk ES 8.x

Splunk Enterprise Security (ES) continues to be a leader in the Gartner Magic Quadrant, reflecting its pivotal ...