Splunk Search

dedup with total counts

phil_dupree
New Member

I have been tasked with building a dashboard which shows the total number of transactions today for each server. I can easily get the distinct servers using dedup; however, I am not sure how to directly get the number of transactions for the day. In order for me to find the number of transactions, I can use eval to subtract the min(ID_Number) from the max(ID_Number) for today; but I cannot figure out how to incorporate this with dedup.

I would like the results to look something like this:

ServerA 105
ServerB 109
ServerC 210

Any assistance is greatly appreciated!

Tags (1)
0 Karma
1 Solution

bwooden
Splunk Employee
Splunk Employee

If I understand correctly, one way would be to use the stats to get min & max per server and then use eval command to calculate total transactions for each. Example:

... | stats min(ID_Number) as min_id max(ID_Number) as max_id by server 
    | eval num_transactions = max_id - min_id
    | table server num_transactions

View solution in original post

0 Karma

bwooden
Splunk Employee
Splunk Employee

If I understand correctly, one way would be to use the stats to get min & max per server and then use eval command to calculate total transactions for each. Example:

... | stats min(ID_Number) as min_id max(ID_Number) as max_id by server 
    | eval num_transactions = max_id - min_id
    | table server num_transactions
0 Karma

phil_dupree
New Member

Perfect! Thank you!

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Using stats count(ID_Number) by server should get you the results you seek without dedup.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...