alexsnemos
alexsnemos

Reputation: 35

logstash limit the size of output file

I am running logstash 6.8.11, using logstash to retrieve logs from a filebeat.

The configuration is quite simple:

input {
beats {
    port => hidden
}
}
output {
if [beat][name] =~ "anonymous*" {
    file {
    path => "/tmp/test-%{+YYYY-MM-DD-HH}"
    codec => json_lines
}
}}

Is there any way I can limit the size of the output file to a specific size (let's say 10MB, or 50MB)

Upvotes: 2

Views: 1781

Answers (1)

Badger
Badger

Reputation: 4072

The file output does not support log rotation based on size itself. There is a long standing open issue that directly speaks to that here (and related issues here and here). The response from the elastic developers was that you can use existing tools like logrotate to do rotation.

Upvotes: 3

Related Questions