Skip to content

The stale files cleanup cycle does not run if no new events #88

@luizgpsantos

Description

@luizgpsantos
input {
    file {
        path => "/tmp/input.json"
        codec => json
    }
}

output {
    file {
        path => "/tmp/output.json.gz"
        codec => "json_lines"
        gzip => "true"
    }
}
  • Sample Data:
$ while true; do echo '{"name":"app1"}' >> /tmp/input.json; sleep 4; done
  • Steps to Reproduce:
  1. Start logstash in debug mode using the pipeline provided above and grep the logs for relevant events:
$ ./bin/logstash -f fileoutputtest.conf --debug

$ tail -f logstash-plain.log | egrep -i "stale|opening|closing"
  1. Write content to the input.json file:

$ while true; do echo '{"name":"app1"}' >> /tmp/input.json; sleep 4; done
  1. Observe that logstash opens /tmp/output.json.gz and the stale check runs every 10 seconds:
[2020-06-01T11:52:48,406][INFO ][logstash.outputs.file    ] Opening file {:path=>"/tmp/output.json.gz"}
[2020-06-01T11:52:48,445][DEBUG][logstash.outputs.file    ] Starting stale files cleanup cycle {:files=>{"/tmp/output.json.gz"=>#<IOWriter:0x7cd4733c @active=true, @io=#<Zlib::GzipWriter:0x7b4db1ec>>}}
[2020-06-01T11:52:48,448][DEBUG][logstash.outputs.file    ] 0 stale files found {:inactive_files=>{}}
[2020-06-01T11:53:00,339][DEBUG][logstash.outputs.file    ] Starting stale files cleanup cycle {:files=>{"/tmp/output.json.gz"=>#<IOWriter:0x7cd4733c @active=true, @io=#<Zlib::GzipWriter:0x7b4db1ec>>}}
[2020-06-01T11:53:00,339][DEBUG][logstash.outputs.file    ] 0 stale files found {:inactive_files=>{}}
  1. Stop writing to input.json and observe that stale checks are not performed anymore (logs does not print stale messages anymore).

Can we improve this behavior to make the stale check event independent? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions