Splunk Dev

Command to get the log size in bytes if there is not field called bytes

suhanrs
New Member

Hi all.
What search command do I have to use to get the file size in bytes if there is no field called bytes?
Can anyone help me with this?

Thank you very much

Tags (1)
0 Karma

kmorris_splunk
Splunk Employee
Splunk Employee

If you are monitoring a file, something like this might work:

<YOUR BASE SEARCH>
    | eval bytes=length(_raw) 
    | stats sum(bytes) by source

Since an ASCII character is 1 byte, and _raw represents an event, you can calculate per event, then sum by source, which should be representative of the log file the data came from. This is dependent upon the assumption that the entire file has been ingested.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

What sourcetype are you talking about?
Do you have any size field? If so, use eval to convert the value in that field to bytes.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Splunk Answers Content Calendar, June Edition

Get ready for this week’s post dedicated to Splunk Dashboards! We're celebrating the power of community by ...

What You Read The Most: Splunk Lantern’s Most Popular Articles!

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...