u123
u123

Reputation: 16331

How to limit the size of log file when using fluentbit file OUTPUT plugin?

Based on this guide:

https://kevcodez.de/posts/2019-08-10-fluent-bit-docker-logging-driver-elasticsearch/

I have started a fluentbit container that collects logs from another ubuntu container and writes the logs to the file:

/home/nonroot/output.txt

based on this configuration file:

[SERVICE]
    log_level debug

[INPUT]
    Name forward
    Listen 0.0.0.0
    port 24224

[OUTPUT]
    Name file
    Match **
    Path /home/nonroot/output.txt

But how to I control the size of the output.txt file so it does not end up using all disk space on the machine where this will eventually run?

Looking at:

https://fluentbit.io/documentation/0.14/output/file.html

I don't see any options to control the file size (e.g. log rotation).

Or does fluentbit assume that log retention/rotate is handled by some other process?

Upvotes: 1

Views: 9603

Answers (1)

rmax
rmax

Reputation: 51

Fluentbit does not allow to set file rotation as of now.

Partial workaround would be to include date to the tag and do not set file name in OUTPUT. Following configuration will create file name based on tag:

[SERVICE]
    log_level debug

[INPUT]
    Name forward
    Listen 0.0.0.0
    port 24224

[OUTPUT]
    Name file
    Match **
    Path /home/nonroot

https://docs.fluentbit.io/manual/pipeline/outputs/file

Upvotes: 2

Related Questions