#6964 migrate setting config.reload.interval to TimeValue

Fixes #7678
This commit is contained in:
Armin 2017-07-13 16:46:19 +02:00 committed by Armin Braun
parent 04163d05e8
commit deaa90e405
8 changed files with 10 additions and 9 deletions

View file

@ -78,7 +78,7 @@
#
# How often to check if the pipeline configuration has changed (in seconds)
#
# config.reload.interval: 3
# config.reload.interval: 3s
#
# Show fully compiled configuration as debug log message
# NOTE: --log.level must be 'debug'

View file

@ -16,7 +16,7 @@ NOTE: The `--config.reload.automatic` option is not available when you specify t
in configuration settings from the command-line.
By default, Logstash checks for configuration changes every 3 seconds. To change this interval,
use the `--config.reload.interval <seconds>` option, where `seconds` specifies how often Logstash
use the `--config.reload.interval <interval>` option, where `interval` specifies how often Logstash
checks the config files for changes.
If Logstash is already running without auto-reload enabled, you can force Logstash to

View file

@ -152,7 +152,7 @@ With this command, Logstash concatenates three config files, `/tmp/one`, `/tmp/t
NOTE: Use SIGHUP to manually reload the config. The default is false.
*`--config.reload.interval RELOAD_INTERVAL`*::
How frequently to poll the configuration location for changes, in seconds. The default is every 3 seconds.
How frequently to poll the configuration location for changes. The default value is "3s".
*`--http.host HTTP_HOST`*::
Web API binding host. This option specifies the bind address for the metrics REST endpoint. The default is "127.0.0.1".

View file

@ -130,7 +130,7 @@ The `logstash.yml` file includes the following settings:
| `config.reload.interval`
| How often in seconds Logstash checks the config files for changes.
| `3`
| `3s`
| `config.debug`
| When set to `true`, shows the fully compiled configuration as a debug log message. You must also set `log.level: debug`.

View file

@ -58,7 +58,8 @@ class LogStash::Agent
@source_loader = source_loader
end
@reload_interval = setting("config.reload.interval")
# Normalize time interval to seconds
@reload_interval = setting("config.reload.interval") / 1_000_000_000.0
@collect_metric = setting("metric.collect")

View file

@ -24,7 +24,7 @@ module LogStash
Setting.new("modules", Array, []),
Setting::Boolean.new("config.test_and_exit", false),
Setting::Boolean.new("config.reload.automatic", false),
Setting::Numeric.new("config.reload.interval", 3), # in seconds
Setting::TimeValue.new("config.reload.interval", "3s"), # in seconds
Setting::Boolean.new("config.support_escapes", false),
Setting::Boolean.new("metric.collect", true),
Setting::String.new("pipeline.id", "main"),

View file

@ -131,7 +131,7 @@ describe LogStash::Agent do
end
context "is set to `TRUE`" do
let(:interval) { 0.01 }
let(:interval) { "10ms" }
let(:agent_settings) do
mock_settings(
"config.reload.automatic" => true,
@ -165,7 +165,7 @@ describe LogStash::Agent do
it "it will keep trying to converge" do
agent_task = start_agent(subject)
sleep(interval * 20) # let the interval reload a few times
sleep(agent_settings.get("config.reload.interval") / 1_000_000_000.0 * 20) # let the interval reload a few times
expect(subject.pipelines_count).to eq(0)
expect(source_loader.fetch_count).to be > 1

View file

@ -208,7 +208,7 @@ describe LogStash::Agent do
let(:pipeline_config) { "input { generator { message => '${FOO}-bar' count => 1 } } filter { } output { file { path => '#{temporary_file}' } }" }
let(:agent_args) { {
"config.reload.automatic" => false,
"config.reload.interval" => 0.01,
"config.reload.interval" => "10ms",
"config.string" => pipeline_config
} }