Exit filebeat on eof?


I want to import a set of static logs, meaning they are not written anymore.
Can I tell filebeat to exit after all harvesters are closed?

I tried --once flag but I get the following error when starting filebeat:

Exiting: input configs and -once cannot be used together

Thanks, Andreas


Sorry, I don't know of any settings like that. Filebeat is designed for dynamic data, so once it's done it will keep waiting in case more comes in. For a fixed set of static files you might just need to run Filebeat and close it manually when it becomes idle. (Run with the -e option so you can see when this happens.)

If this is something you need to do a lot such that checking manually is inconvenient, you can probably also just terminate it after a certain amount of time (this would require a reasonable idea of how much data to expect / how fast the ingestion proceeds, but e.g. unless you're expecting a very large amount of data and / or a very slow connection it would be surprising if it were still going after a day).

Filebeat also uses minimal resources when there are no incoming changes (most of its memory use is the queue of pending data, which will be empty once it's processed everything), so it is also usually harmless to just leave it running semi-indefinitely until you're ready to clean everything up, although this depends on your particular situation.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.