Splunk Enterprise Security

How to get the size of a lookup file from Splunk search

lucas4394
Path Finder

Hi all,

Does anyone know how to get the file size of a lookup file from Splunk search?

thanks.

0 Karma

morethanyell
Builder

Please try this new custom command I built:

https://splunkbase.splunk.com/app/6735

0 Karma

jawaharas
Motivator

Not a efficient way but works. But you need to input list of field names from the CSV file. And the file size may be accurate as it's based on number of characters.

| inputlookup myfile
| fillnull value=NULL
| eval all_fields=field1 . field2 . field3
| eval raw_len=len(all_fields) 
| stats sum(raw_len) as total_char
| eval size_in_bytes=round(total_char/1024,2)

stevem
Engager

A little nicer would be to use foreach, some options but example-

| foreach * [ | eval bytes_<<FIELD>>=len(<<FIELD>>)+1 ]
| addtotals bytes_* fieldname=bytes_row | eval bytes_row=bytes_row+1
| stats sum(bytes_row) as bytes_total

Tags (2)

jawaharas
Motivator

@lucas4394
Can you accept the answer if it's helped you? Thanks.

0 Karma
Get Updates on the Splunk Community!

Introducing a Smarter Way to Discover Apps on Splunkbase

We’re excited to announce the launch of a foundational enhancement to Splunkbase: App Tiering. Because we’ve ...

How to Send Splunk Observability Alerts to Webex teams in Minutes

As a Developer Evangelist at Splunk, my team and I are constantly tinkering with technology to explore its ...

.conf25 Registration is OPEN!

Ready. Set. Splunk! Your favorite Splunk user event is back and better than ever. Get ready for more technical ...