Reloading the Config File

Starting with Logstash 2.3, you can set Logstash to detect and reload configurationchanges automatically.

To enable automatic config reloading, start Logstash with the --config.reload.automatic (or -r)command-line option specified. For example:

bin/logstash –f apache.config --config.reload.automatic
Note

The --config.reload.automatic option is not available when you specify the -e flag to passin 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 <interval> option, where interval specifies how often Logstashchecks the config files for changes.

If Logstash is already running without auto-reload enabled, you can force Logstash toreload the config file and restart the pipeline by sending a SIGHUP (signal hangup) to theprocess running Logstash. For example:

kill -SIGHUP 14175

Where 14175 is the ID of the process running Logstash.

How Automatic Config Reloading Works

When Logstash detects a change in a config file, it stops the current pipeline by stoppingall inputs, and it attempts to create a new pipeline that uses the updated configuration.After validating the syntax of the new configuration, Logstash verifies that all inputsand outputs can be initialized (for example, that all required ports are open). If the checksare successful, Logstash swaps the existing pipeline with the new pipeline. If the checksfail, the old pipeline continues to function, and the errors are propagated to the console.

During automatic config reloading, the JVM is not restarted. The creating and swapping ofpipelines all happens within the same process.

Changes to grok pattern files are also reloaded, but only whena change in the config file triggers a reload (or the pipeline is restarted).