Splunk Search

Add a summary row to a statistics table

dbcase
Motivator

Hi,

I have this search:

index=mso_statistics sourcetype=ic_connectivity_5min-too_small stat_name = "cell" |eval mso = upper(substr(mso,1,1)).lower(substr(mso,2)) |stats sparkline(avg(stat_val)) as "Trend" first(stat_val) as "Current Cell Connectivity %" by mso|rename mso as "MSO - Click for Expanded View"

Which produces this Statistics Table (first column intentionally omitted)
alt text

What I'd like to do is append to the table at the bottom a row that indicates Avg, mean, etc of the data. I've tired append and appendpipe but the data never seems to display. (note: I've never used append or appendpipe before so it is VERY likely it is something I'm doing wrong)

0 Karma
1 Solution

sundareshr
Legend

Try moving the appendpipe to after the stats command. Like this

 index=mso_statistics sourcetype=ic_connectivity_5min-too_small stat_name = "cell" |eval mso = upper(substr(mso,1,1)).lower(substr(mso,2)) |stats sparkline(avg(stat_val)) as "Trend" first(stat_val) as "Current Cell Connectivity %" by mso |appendpipe [stats avg(stat_val) as "Current Cell Connectivity %" | eval mso = "ALL MSO's"] |rename mso as "MSO - Click for Expanded View"

View solution in original post

0 Karma

sundareshr
Legend

Try moving the appendpipe to after the stats command. Like this

 index=mso_statistics sourcetype=ic_connectivity_5min-too_small stat_name = "cell" |eval mso = upper(substr(mso,1,1)).lower(substr(mso,2)) |stats sparkline(avg(stat_val)) as "Trend" first(stat_val) as "Current Cell Connectivity %" by mso |appendpipe [stats avg(stat_val) as "Current Cell Connectivity %" | eval mso = "ALL MSO's"] |rename mso as "MSO - Click for Expanded View"
0 Karma

dbcase
Motivator

Hi Sundareshr,

I tried that one as well hoping it would do the trick but when I do the resulting table doesn't have any of the entries.

Meaning, no average and no "ALL MSO's" in the first column. I only got the ALL MSO's to show up when I put the appendpipe before the stats command

0 Karma

sundareshr
Legend

Then try this..

 index=mso_statistics sourcetype=ic_connectivity_5min-too_small stat_name = "cell" |eval mso = upper(substr(mso,1,1)).lower(substr(mso,2)) |stats sparkline(avg(stat_val)) as "Trend" first(stat_val) as "Current Cell Connectivity %" by mso |append [search index=mso_statistics sourcetype=ic_connectivity_5min-too_small stat_name = "cell" |eval mso = upper(substr(mso,1,1)).lower(substr(mso,2))  
 stats avg(stat_val) as "Current Cell Connectivity %" | eval mso = "ALL MSO's"] |rename mso as "MSO - Click for Expanded View"

dbcase
Motivator

BINGO!!!! Thank you Sundareshr!!!!

0 Karma

dbcase
Motivator

updated query, a bit closer but still not quite there

This one does get an entry into the first column (the one that was omitted) but no entry in the last column

index=mso_statistics sourcetype=ic_connectivity_5min-too_small stat_name = "cell" |eval mso = upper(substr(mso,1,1)).lower(substr(mso,2)) |appendpipe [stats avg(stat_val) as "Current Cell Connectivity %" | eval mso = "ALL MSO's"]|stats sparkline(avg(stat_val)) as "Trend" first(stat_val) as "Current Cell Connectivity %" by mso|rename mso as "MSO - Click for Expanded View"
0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...