How to Auto-Reload Logstash Configuration

Better Stack Team
Updated on April 5, 2024

To enable Logstash to detect and reload the configuration file automatically, you can use the --config.reload.automatic option when starting Logstash. Here's how to activate it.

When launching Logstash, include the --config.reload.automatic flag in your command:

 
bin/logstash -f <path-to-logstash-conf>.config --config.reload.automatic

If you've followed our installation guide, your command might look like:

 
sudo -u logstash /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/logstash.conf --config.reload.automatic

The option tells Logstash to periodically check the configuration file for any changes, typically every 3 seconds by default. To adjust the frequency of these checks, use the config.reload.interval <interval> option, substituting <interval> with the desired time frame in seconds.

If Logstash is already running without the --config.reload.automatic option, you can force a configuration file to reload by sending a SIGHUP (signal hangup) to the Logstash process:

 
kill -SIGHUP <25473>

Replace the <25473> with the actual process ID of your Logstash instance.

To learn more about Logstash, check out our comprehensive guide. It provides detailed insights into collecting, transforming, and forwarding logs to various destinations.

Got an article suggestion? Let us know
Explore more
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.