Splunk Search

How to calculate the size of the events per field?

pavanae
Builder

I have a query as follows

index=abc sourcetype=def | stats count by field_A | eval mb=round(count/1024/1024,2)

which gives me the result as follows

field_A count mb
jjjh 237606517 230.43
gffgf 2763240 2.67

Now, my question is that is the megabytes(mb) calcullation per each field is correct?

Also the count for each field value is it in bytes ?

I am a bit confused and all I'm trying to get the result as follows

Field_A - Count of Event - Average size of that event

0 Karma
1 Solution

woodcock
Esteemed Legend

Like this:

index=abc sourcetype=def 
| eval bytes=len(_raw)
| stats count avg(bytes) BY field_A
| eval mb=round(bytes/1024/1024,2)

View solution in original post

0 Karma

woodcock
Esteemed Legend

Like this:

index=abc sourcetype=def 
| eval bytes=len(_raw)
| stats count avg(bytes) BY field_A
| eval mb=round(bytes/1024/1024,2)
0 Karma

xpac
SplunkTrust
SplunkTrust

I don't really get what you're trying to do.
You're counting the events, and then divide the count by 1024 twice to get an MB value?
Are you trying to get the actual size of the events and the average event's size?

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...