command: ['--config.reload.automatic']
somewhere under the logstash
service in the Compose file and Logstash will automatically reload your config when it changes.
env:
in the Compose file). You should end up with - --config.reload.automatic
if you opt for that syntax (dash space dash dash..., looks weird but it's 100% valid).
docker_elk
network created by Compose and then you won't even need to expose port 5601 on your host.
command: ['--config.reload.automatic']
command:
- --config.reload.automatic
[2021-02-05T15:04:53,567][INFO ][logstash.javapipeline ][main] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>48, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50, "pipeline.max_inflight"=>6000, "pipeline.sources"=>["/usr/share/logstash/pipeline/logstash.conf"], :thread=>"#<Thread:0x18973e34 run>"}
logstash.yml
file, contrary to what I told you above: https://www.elastic.co/guide/en/logstash/7.10/logstash-settings-file.html
logstash_1 | [2021-02-05T15:28:21,868][INFO ][logstash.pipelineaction.reload] Reloading pipeline {"pipeline.id"=>:main}
logstash_1 | [2021-02-05T15:28:32,879][INFO ][logstash.javapipeline ][main] Pipeline terminated {"pipeline.id"=>"main"}
...
logstash_1 | [2021-02-05T15:28:33,592][INFO ][logstash.javapipeline ][main] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>8, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50, "pipeline.max_inflight"=>1000, "pipeline.sources"=>["/usr/share/logstash/pipeline/logstash.conf"], :thread=>"#<Thread:0x1865a88d run>"}
...
logstash_1 | [2021-02-05T15:28:33,697][INFO ][logstash.javapipeline ][main] Pipeline started {"pipeline.id"=>"main"}
log.level=debug
(can also be set in the config file) and see where it hangs in the logs? (warning: Logstash will produce a LOT of logs in debug mode)
Actually it's a test installation... so there is almost no incoming data (apart from one test server).
At the end it works, but it takes a quite while to restart (around 2mn) as I can see in the logs !
[2021-02-05T15:43:48,802][INFO ][logstash.pipelineaction.reload] Reloading pipeline {"pipeline.id"=>:main}
[2021-02-05T15:44:00,577][INFO ][logstash.javapipeline ][main] Pipeline terminated {"pipeline.id"=>"main"}
[2021-02-05T15:44:04,668][INFO ][logstash.javapipeline ][main] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>48, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50, "pipeline.max_inflight"=>6000, "pipeline.sources"=>["/usr/share/logstash/pipeline/logstash.conf"], :thread=>"#<Thread:0x47483bae run>"}
Then it hangs up... but after a while...
[2021-02-05T15:45:39,510][INFO ][logstash.javapipeline ][main] Pipeline Java execution initialization time {"seconds"=>94.84}
[2021-02-05T15:45:39,549][INFO ][logstash.inputs.beats ][main] Starting input listener {:address=>"0.0.0.0:5044"}
[2021-02-05T15:45:39,553][INFO ][logstash.javapipeline ][main] Pipeline started {"pipeline.id"=>"main"}
Indeed, brutally restarting the docker container is faster !
latest
tag are those images).build:
directives with image:
in the Compose file, and use Elastic's images directly.
docker-elk_...
with the latest
tag). The reason is exactly that: plugins!