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!

Splunk Observability Cloud | Unified Identity - Now Available for Existing Splunk ...

Raise your hand if you’ve already forgotten your username or password when logging into an account. (We can’t ...

Index This | How many sides does a circle have?

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

Registration for Splunk University is Now Open!

Are you ready for an adventure in learning?   Brace yourselves because Splunk University is back, and it's ...