Splunk Search

Is there a way to get the addcototals to show in the first column instead of appending to the last?

Substance82
Path Finder

Here is my current query. I either get the Totals label in the last column or not at all. I need it to show in the first column at the beginning of the Totals row. Any help is greatly appreciated. Thanks. 

index=etims_na
sourcetype=etims_prod
platformId=5
bank_fiid=CHUA
| eval response_time=round(if(strftime(_time,"%Z") == "EDT",((j_timestamp-entry_timestamp)-14400000000)/1000000,((j_timestamp-entry_timestamp)-14400000000)/1000000-3600),3)
| stats count AS Transactions count(eval(response_time <= 1)) AS "Good" count(eval(response_time <= 2)) AS "Fair" count(eval(response_time > 2)) AS "Unacceptable" avg(response_time) AS "Average" BY bank_fiid
| eval "%Good"=(Good/Transactions)*100
| eval "%Fair"=(Fair/Transactions)*100
| eval "%Unacceptable"=(Unacceptable/Transactions)*100
| addinfo
| eval "Report Date"=strftime(info_min_time, "%m/%Y")
| table bank_fiid, "Transactions", "Good", "%Good" "Fair", "%Fair", "Unacceptable", "%Unacceptable", "Average", "Report Date"
| rename bank_fiid as "Vision ID"
| addcoltotals label=Total
| append [|makeresults
| eval "Vision ID"="Threshold"
| eval "Good" = "response <= 1s"
| eval "Fair" = "1s < response <= 3s"
| eval "Unacceptable" = "3s < response"]
| fields - _time
Labels (3)
Tags (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Use the labelfield option.  It tells Splunk into which field (column) to put the total.

...
| table bank_fiid, "Transactions", "Good", "%Good" "Fair", "%Fair", "Unacceptable", "%Unacceptable", "Average", "Report Date"
| rename bank_fiid as "Vision ID"
| addcoltotals label=Total labelfield=bank_fiid
...

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

Substance82
Path Finder

Never mind. I posted too soon. I replaced "| addcoltotals label=Total " with "| addcoltotals labelfield="Vision ID" label="Total"" and it worked. Thanks.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Use the labelfield option.  It tells Splunk into which field (column) to put the total.

...
| table bank_fiid, "Transactions", "Good", "%Good" "Fair", "%Fair", "Unacceptable", "%Unacceptable", "Average", "Report Date"
| rename bank_fiid as "Vision ID"
| addcoltotals label=Total labelfield=bank_fiid
...

 

---
If this reply helps you, Karma would be appreciated.

Substance82
Path Finder

Thanks! This was exactly the fix I found. 

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 ...