Dashboards & Visualizations

Combining two graphs into ONE

macadminrohit
Contributor

Hi Have the below Searches , most of which are common, only different is i am doing a regex in one of them to compare the string with a number. I am not sure if i can use a streamstats to combine two searches together to avoid running the search twice. Basically i want to combine the two graphs into one i.e one search will give a line graph and another will give a bar graph, like an overlay. With Same x-axis i.e count .

index=servers sourcetype=xs_json Name="Server App" Version=*
| bucket _time span=1h
| timechart count AS HTTP_COUNT by Url useother=f usenull=f limit=50
| fillnull value=0

index=servers sourcetype=xs_json Name="Server App" Version=*
| bucket _time span=1h
| rex field=_raw "Response Code\",\"value\":\"(?<RespCode>\w+)\"}," | where RespCode!=200
| timechart count AS ERROR_COUNT by Url useother=f usenull=f limit=50
| fillnull value=0

Tags (1)
0 Karma
1 Solution

adonio
Ultra Champion

hello there,

you can use conditional eval in timechart as well

 index=servers sourcetype=xs_json Name="Server App" Version=* 
| bucket _time span=1h 
| rex field=_raw "Response Code\",\"value\":\"(?<RespCode>\w+)\"}," 
| timechart count(eval(RespCode>200) AS ERROR_COUNT count as HTTP_COUNT by Url useother=f usenull=f limit=50 
| fillnull value=0

hope it helps

View solution in original post

0 Karma

adonio
Ultra Champion

hello there,

you can use conditional eval in timechart as well

 index=servers sourcetype=xs_json Name="Server App" Version=* 
| bucket _time span=1h 
| rex field=_raw "Response Code\",\"value\":\"(?<RespCode>\w+)\"}," 
| timechart count(eval(RespCode>200) AS ERROR_COUNT count as HTTP_COUNT by Url useother=f usenull=f limit=50 
| fillnull value=0

hope it helps

0 Karma

macadminrohit
Contributor

Basically i dont want to combine the queries to get a single query, i want two graphs into an overlay. First query results into a bar graph and the second results into a line chart. I want those two graphs to overlay.

0 Karma

adonio
Ultra Champion

use the chart overlay function in the viz
have it as a bar chart and then pick the field you want for chart overlay

macadminrohit
Contributor

Thank you so Much Adonio. It works like a champ.

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!

Make Your Machine Data AI-Ready in Splunk

Every team is getting ready for AI agents.   Thursday, November 12, 2026  |  11AM  PST / 2PM EST   ...

Splunk Asynchronous Forwarding Explained

Splunk asynchronous forwarding is often misunderstood as simply setting autoLBVolume. That is not quite right. ...

How to Monitor AI Agents with Splunk Agent Observability

Let’s say I’m running a travel planning AI app in production. A user asks for three concise hotel options in ...