Splunk Search

Dumb question - average of a count

msarro
Builder

Hey everyone. I'm having a dumb moment, so please be gentle.
I have a number of records, and each one has an ID to identify which set of transactions it belongs to (Local_Call_ID_Trimmed). What I am trying to do is find out what the average number of records is, per transaction. Here is what I'm currently using, which isn't working. I'm not really interested in sorting it in any particular way so i'm not sure if the "by" statement is needed.

index=corrtest sourcetype=AS-CDR|rex field=AS_Local_Call_ID "(?P<AS_Local_Call_ID_Trimmed>\d+)(?=:)"|stats avg(count(AS_Local_Call_ID_Trimmed)) by AS_Local_Call_ID_Trimmed

I know this should be way easier than it is, but for some reason my brain isn't working this morning 🙂 Any help would be appreciated. thanks!

Tags (1)
1 Solution

gkanapathy
Splunk Employee
Splunk Employee
index=corrtest sourcetype=AS-CDR
| rex field=AS_Local_Call_ID "(?P<AS_Local_Call_ID_Trimmed>\d+)(?=:)" 
| stats count by AS_Local_Call_ID_Trimmed
| stats avg(count)

View solution in original post

gkanapathy
Splunk Employee
Splunk Employee
index=corrtest sourcetype=AS-CDR
| rex field=AS_Local_Call_ID "(?P<AS_Local_Call_ID_Trimmed>\d+)(?=:)" 
| stats count by AS_Local_Call_ID_Trimmed
| stats avg(count)

msarro
Builder

Worked wonderfully, thank you!

0 Karma
Get Updates on the Splunk Community!

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...