Splunk Search

Combine similar queries to create summary index

mukeshchandak
Engager

How can I combine these 3 queries given everything before pipe is same:

query1: index=abc source="*/d/e/f.log" artifact_id=g*h*i* host!=“jkl*” cloud=mno consumer_id=* response_code=*|timechart span=1s count

query2: index=abc source="*/d/e/f.log" artifact_id=g*h*i* host!=“jkl*” cloud=mno consumer_id=* response_code=*|timechart span=5m eval(count()) as "Response Code" by response_code

query3: index=abc source="*/d/e/f.log" artifact_id=g*h*i* host!=“jkl*” cloud=mno consumer_id=* response_code=*| timechart span=5m avg(response_time) as "Avg Response Time" p99(response_time) as "99 Percentile" p95(response_time) as "95 Percentile"

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @mukeshchandak,

you could use the append command to put the three searches in one and collect the results in one, but there's the problem that you have different fields.

You could also schedule three different searches and save results in a summary to quicly have results.

But in my opinion, the best solution is to save results of one simple search in a Summary, then running the searches with timechart in three different panels.

In other words, I'd schedule this search, e.g. every 5 minutes:

index=abc source="*/d/e/f.log" artifact_id=g*h*i* host!=“jkl*” cloud=mno consumer_id=* response_code=*
| table _time response_time response_code
| collect index=my_summary

then I'd run the three searches in different dashboard panels:

query1: 
index=my_summary
| timechart span=1s count

query2: 
index=my_summary
| timechart span=5m eval(count()) as "Response Code" by response_code

query3: 
index=my_summary
| timechart span=5m avg(response_time) as "Avg Response Time" p99(response_time) as "99 Percentile" p95(response_time) as "95 Percentile"

Ciao.

Giuseppe

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...