Splunk Search

Transactions: summing up repeated fields

twinspop
Influencer

I have server farms made up of 4 servers each. I have various stats from each posted once per minute. I want to group them together based on their farm, sum up their stats for each minute, then be able to perform more analysis (perc95, avg, etc) on those aggregated values.

Eg:

12:34:50 host=server1 farm=1 bps=1000 hps=10
12:34:51 host=server2 farm=1 bps=900 hps=9
12:34:51 host=server3 farm=1 bps=1100 hps=10
12:35:02 host=server4 farm=1 bps=1000 hps=9

Combine that into one event using transaction

| transaction farm maxspan=59s

But I need to create a totalBps field equal to 4000 and a totalHps field equal to 38. Then I'd be able to run something like:

| stats perc95(totalBps) by farm

I haven't been able to wrap my head around what's needed to make that possible.

Tags (2)
0 Karma
1 Solution

gkanapathy
Splunk Employee
Splunk Employee

You don't need transaction. Grouping is best done by stats or timechart, not transaction.

sourcetype=mystatsdata 
| bucket _time span=1m 
| stats sum(bps) as totalbps sum(hps) as totalhps
  by _time,farm 
| stats 
    perc95(totalbps) 
    perc95(totalhps) 
    median(totalhps)
  by farm

View solution in original post

gkanapathy
Splunk Employee
Splunk Employee

You don't need transaction. Grouping is best done by stats or timechart, not transaction.

sourcetype=mystatsdata 
| bucket _time span=1m 
| stats sum(bps) as totalbps sum(hps) as totalhps
  by _time,farm 
| stats 
    perc95(totalbps) 
    perc95(totalhps) 
    median(totalhps)
  by farm
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...