Getting Data In

How to determine the average size of my indexed events?

hexx
Splunk Employee
Splunk Employee

It can sometimes be interesting to know the average event size for a given source or sourcetype. How can this be achieved?

1 Solution

hexx
Splunk Employee
Splunk Employee

If you want to check the average size in bytes of your events broken down by sourcetype, you can run the following search :

  • | eval esize=len(_raw) | stats avg(esize) by sourcetype

Of course, feel free to replace "*" with a specific data set you want to study, and don't forget to adequately set the time frame of the search.

Here's the same search but also showing the 10th and 90th percentile for event size (in bytes) broken down by sourcetype :

  • | eval esize=len(_raw) | stats p10(esize), avg(esize), p90(esize) by sourcetype

To obtain this breakdown by source instead of sourcetype, just replace "by sourcetype" with "by source" at the end of the stats command.

View solution in original post

hexx
Splunk Employee
Splunk Employee

If you want to check the average size in bytes of your events broken down by sourcetype, you can run the following search :

  • | eval esize=len(_raw) | stats avg(esize) by sourcetype

Of course, feel free to replace "*" with a specific data set you want to study, and don't forget to adequately set the time frame of the search.

Here's the same search but also showing the 10th and 90th percentile for event size (in bytes) broken down by sourcetype :

  • | eval esize=len(_raw) | stats p10(esize), avg(esize), p90(esize) by sourcetype

To obtain this breakdown by source instead of sourcetype, just replace "by sourcetype" with "by source" at the end of the stats command.

mendesjo
Path Finder

Thanks, rather than average how would you total it up? So I want total size of events for a particuliar sourcetype in an index? Thanks!

0 Karma

mtulett_splunk
Splunk Employee
Splunk Employee

Instead of avg() you can use sum(), like so:
- | eval esize=len(_raw) | stats sum(esize) as bytes by sourcetype

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...