Splunk Search

How do you get the count value by using tstats or stats command?

rakesh44
Communicator

Hi Team,

I am using the below command for getting the total value of Payable_Column & show the total count:

index=ghl_gj sourcetype="Gaget" Period="Aug-18" | where date="2018-12-16" | stats count by Payable_Column | addcoltotals

Example

Payable_Column Count
1 1
2 2
3 2

Required
Payable_Column Count
6 5

0 Karma

sdchakraborty
Contributor
index=ghl_gj sourcetype="Gaget" Period="Aug-18" | where date="2018-12-16" | stats count by Payable_Column | stats  sum(Payable_Column) as Payable_Column , sum(count) as count

is that what you want?

Sid

0 Karma

rakesh44
Communicator

@sdchakraborty Perfect but it is taking too much time to fetch data , i have 4000000 events. Can we expedite by using tstats command

0 Karma

ddrillic
Ultra Champion

You can use tstats if the fields in the command are index fields.

0 Karma

rakesh44
Communicator

but what be the command

| tstats index=ghl_gj sourcetype="Gaget" Period="Aug-18" | where date="2018-12-16" | stats count by Payable_Column | stats sum(Payable_Column) as Payable_Column , sum(count) as count

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!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...