Splunk Search

Query help with search using sum(count) and 2 subsearches using count

subtrakt
Contributor

I have a query that combines 1 search and 2 sub-searches. The main search is a summary index and sum(count) in the timechart to look right. The 2 sub searches do not need sum(count) - they just need "count" so they are represented properly on the timechart.

I was thinking if there was a way to convert sum(count) to count I would be good.

This summary index runs every 15 minutes and buckets by the minute:

Here's my Attempt to translate sum(count) to count:
index="summary_onemin" error | evenstats sum(count) as count by _time | append [| search index=power_user "null" | bucket _time span=2m | eval CODE=powerNULL] | timechart span=2m by CODE

Without the subsearch the search would look like this and works as intended:
index="summary_onemin" error | timechart sum(count) as COUNT by CODE

1 Solution

somesoni2
SplunkTrust
SplunkTrust

Try this

 index="summary_onemin" error | table _time CODE count 
| append [search index=power_user "null" | bucket _time span=2m | eval CODE=powerNULL
| stats count by _time, CODE] 
| timechart span=2m sum(count) as count by CODE

View solution in original post

somesoni2
SplunkTrust
SplunkTrust

Try this

 index="summary_onemin" error | table _time CODE count 
| append [search index=power_user "null" | bucket _time span=2m | eval CODE=powerNULL
| stats count by _time, CODE] 
| timechart span=2m sum(count) as count by CODE

subtrakt
Contributor

Thanks Somesoni!

0 Karma

somesoni2
SplunkTrust
SplunkTrust

Can you post your full search?

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...