Splunk Search

How to get the sum of some particular row in a separate row at the end of the table?

pal_sumit1
Path Finder

team12 sum1
atgbc.im 10
bctgd.im 20
cdtgb.im 30
abrfc.in 40
bcded.in 50
total (.im) 60
total (.in) 90
total(in+im)150

Fields names are "name" and "sum"."Team12" is the name of the list having all (.in and .im files)
We have to figure out how to calculate total(.im) and total(.in)?

Tags (2)
0 Karma
1 Solution

somesoni2
Revered Legend

You would use appendpipe command like this:

your current search giving field name and sum
| appendpipe [| where like(name,"%.im") | eval name="total (.im)" | stats sum(sum) as sum by name]
| appendpipe [| where like(name,"%.in") | eval name="total (.in)" | stats sum(sum) as sum by name]
| appendpipe [| where like(name,"total%") | eval name="total all" | stats sum(sum) as sum by name]

View solution in original post

somesoni2
Revered Legend

You would use appendpipe command like this:

your current search giving field name and sum
| appendpipe [| where like(name,"%.im") | eval name="total (.im)" | stats sum(sum) as sum by name]
| appendpipe [| where like(name,"%.in") | eval name="total (.in)" | stats sum(sum) as sum by name]
| appendpipe [| where like(name,"total%") | eval name="total all" | stats sum(sum) as sum by name]

pal_sumit1
Path Finder

THE CODE YOU HAVE WRITTEN IS CORRECT AND IT IS WORKING FINE.
I will extend this problem, Suppose we have a drop-down in dashboard having three option,1- total all,2-total-(.im) 3- total-(.in).So if we select option -1 then It should display all the individual team ,total(im),total(in),total.
if we select option -2 then it should display only (.im) teams and total(.im) and similarly if we select 3 option,it should display all (.in) team and total(.in).

Can we implement this using only one search?

I have used three search for that but want to implement it using only one.

0 Karma

somesoni2
Revered Legend

You can. Your dropdown token value should be
1. * for option 1 - total all
2. *(im)* for option 2- 2-total-(.im)
3. *(in)* for option 2- 2-total-(.in)

And your search should be this

 your current search giving field name and sum
 | appendpipe [| where like(name,"%.im") | eval name="total (.im)" | stats sum(sum) as sum by name]
 | appendpipe [| where like(name,"%.in") | eval name="total (.in)" | stats sum(sum) as sum by name]
 | appendpipe [| where like(name,"total%") | eval name="total all" | stats sum(sum) as sum by name]
 | search name="$DropdownTokenName$"
0 Karma

pal_sumit1
Path Finder

Yeah ,It is working fine.
Thanks

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...