Splunk Search

How do you create a total column in a chart?

barrowvian
Explorer

Hi,

I'm pretty new to Splunk and have been playing around with it.

index=sse_cae_summary_idx new_sourcetype=sse_altair_log_summary_stype 
| search FEATURE_NAME="HWHyperMesh*"  FEATURE_VERSION="9.0" 
| eval DurationHour=DURATION/3600 
| chart dc(USER_NAME) as "Unique Users" by USER_NAME

The above code simply gives me each unique user that is using version 9 of Hypermesh. The chart has two columns, username and unique users. The unique users column has a 1 in for each of the users . Ideally, I'd rather have a total column that just details the amount of unique users that are in the search. Please could someone help me out? Thank you.

1 Solution

harishalipaka
Motivator

hi @barrowvian

try to add end of your query with | addtotals or | addcoltotals

Thanks
Harish

View solution in original post

barrowvian
Explorer

|addcoltotals

0 Karma

harishalipaka
Motivator

hi @barrowvian

try to add end of your query with | addtotals or | addcoltotals

Thanks
Harish

barrowvian
Explorer

That worked perfectly, thank you. Was literally just reading about it as you posted.

0 Karma

renjith_nair
Legend

@barrowvian,

Just add to your search |eventstats sum("Unique Users") as Total to get a total in each record

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

barrowvian
Explorer

Thanks, but this creates a separate column with a value in each of the rows ..

e.g.
User_Name Unique Users Total
User1 1 3
User2 1 3
User3 1 3

Is there a way to just have one field with the total value in instead? Thank you.

0 Karma

renjith_nair
Legend

@barrowvian,
Ofcourse we can do it. just to be clear, how does your final output should look like?

---
What goes around comes around. If it helps, hit it with Karma 🙂
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!

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...

Customer success is front and center at .conf25

Hi Splunkers, If you are not able to be at .conf25 in person, you can still learn about all the latest news ...