Logstash: How I can check sintax logstash 5.0

Created on 3 Nov 2016  路  6Comments  路  Source: elastic/logstash

Hello/
In logstash 2.x I use the next command
/usr/share/logstash/bin/logstash --configtest -f /etc/logstash/conf.d/*.conf
to check config syntax. But in logstash 5.0 it doesn't work.
And the next, if I create mistakes in logstash config and use
initctl restart logstash
I don't have stdout message about error.

How can I check config syntax in logstash 5.0?

v5.0.0

Most helpful comment

This is now the config.test_and_exit setting. (see https://www.elastic.co/guide/en/logstash/current/logstash-settings-file.html)

You should be able to use this as a flag: --config.test_and_exit

All 6 comments

logstash -f /etc/logstash/conf.d/ -t
or
logstash -f /etc/logstash/conf.d/ --config.test_and_exit

--configtest option no longer exist. Try "logstash -h" for more details

5.x onwards, it doesnt support log output in console. Please check below issue

6161

This is now the config.test_and_exit setting. (see https://www.elastic.co/guide/en/logstash/current/logstash-settings-file.html)

You should be able to use this as a flag: --config.test_and_exit

logstash -f /etc/logstash/conf.d/ -t

when i use this it throws error
**bash: logstash: command not found**

@viveksamaga make sure you are in the right path where the logstash file is. also your shell may not have the current directory as part of the path, so you may need to do ./logstash -f "/etc/logstash/conf.d/*" -t

In ubuntu 16.10, if you have installed logstash using apt-get then use-
$ /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/ --config.test_and_exit

./logstash -t -f /path/to/config/file --path.settings=/etc/logstash/config.d

Was this page helpful?
0 / 5 - 0 ratings