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
Register for .conf21 Now! Go Vegas or Go Virtual!

How will you .conf21? You decide! Go in-person in Las Vegas, 10/18-10/21, or go online with .conf21 Virtual, 10/19-10/20.