Getting Data In

Is it possible to have a Splunk universal forwarder read a growing file and delete it when it's done?

acidkewpie
Path Finder

Howdy,

I want to ingest files on a universal forwarder that are still being written, and to delete them once the file has finished being written to - i.e. no other open file handles. Is this a default behavior?

Basically I want to write a large number of files to disk, and deliberately only keep them open for a short period of time, where short could be a minute, and after that time, a new file would be created, timestamped with a different minute, for example. So I'm ONLY writing them to disk for Splunk to grab hold of them, and once splunk has read the entire file, it'll serve no further purpose. But I want Splunk to delete it when it knows it can (with UseACK enabled etc.). So if Splunk is poorly then the files will just mount up until it can pick up the backlog.

I'm just concerned that the file will be deleted as soon as it reaches the end of the file at a given point in time, and then the rest of the data would be written to a deleted handle? Would Splunk just hang on each file until it is closed? Is there no EOF until that point anyway, or would it always see an EOF if it runs out of data?

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

You could use the batch input type in Splunk, that will delete the file after reading it. However, you will have to make sure that the files are written slowly elsewhere, and atomically moved into the monitored path after they are finished. Else Splunk could start reading and deleting a partial file.

See http://docs.splunk.com/Documentation/Splunk/6.2.3/admin/inputsconf for more info on batch:// input configuration.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...