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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...