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
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...