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!

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...

Skip the Awkward Silence: Have a .conf-ersation at .conf26

Picture this. You arrive at .conf26 already having your socializing and networking plans mapped out. No ...

Rethinking Zero Trust: From Product Purchases to Logical Control Evidence

Implementing Zero Trust (ZT) across complex environments often falters at the very beginning due to a ...