elastic / logstash

Logstash - transport and process your logs, events, or other data
https://www.elastic.co/products/logstash
Other
14.17k stars 3.49k forks source link

service logstash configtest no longer honored. #6161

Open rsaeks opened 7 years ago

rsaeks commented 7 years ago

Previous versions verified configuration and displayed error output. Running the same command in a 5.0 system returns:

The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.

untergeek commented 7 years ago

If you used the RPM package to install, this is expected. Logstash will not likely respond to the service command because it installed a systemd service file.

See https://www.elastic.co/guide/en/logstash/current/running-logstash.html

Logstash will need to be started with systemctl start logstash, or the like.

If you still want to do a configtest, try running this:

$ sudo -u logstash /usr/share/logstash/bin/logstash --path.settings /etc/logstash -t
Sending Logstash logs to /var/log/logstash which is now configured via log4j2.properties.
Configuration OK

I ran this command on a CentOS 7 VM, and got the Configuration OK result.

rsaeks commented 7 years ago

When running the same command I only get: Sending Logstash logs to /var/log/logstash which is now configured via log4j2.properties.

The Configuration OK line doesn't appear.

On Tue, Nov 1, 2016 at 2:27 PM, Aaron Mildenstein notifications@github.com wrote:

If you used the RPM package to install, this is expected. Logstash will not likely respond to the service command because it installed a systemd service file.

See https://www.elastic.co/guide/en/logstash/current/running-logstash.html

Logstash will need to be started with systemctl start logstash, or the like.

If you still want to do a configtest, try running this:

sudo -u logstash /usr/share/logstash/bin/logstash --path.settings /etc/logstash -t Sending Logstash logs to /var/log/logstash which is now configured via log4j2.properties. Configuration OK

I ran this command on a CentOS 7 VM, and got the Configuration OK result.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/elastic/logstash/issues/6161#issuecomment-257668196, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6eHNZU8EFcV4whkSXXRaRQt8-L9W8Fks5q55K9gaJpZM4KmcBM .

untergeek commented 7 years ago

Did it ever return control to the command prompt? What do you get in the log files in /var/log/logstash?

bimalm commented 7 years ago

Latest version of logstash logs output to /var/log/logstash/logstash-plain.log. Tail this file to know what is happening. "Configuration OK" will appear only if there is no error in the conf file. Errors will be logged to /var/log/logstash/logstash-plain.log

rsaeks commented 7 years ago

@untergeek Control did return back to the console. @bimalm Thanks - I had other messages in the logstash-plain.log which were burying the errors.

Is the previous functionality available to be set via the config where if there is an error in the config it is displayed to the console rather than the log file? This would allow the issue to be presented in one location versus needing to check in another spot.

untergeek commented 7 years ago

Not via a startup script. The above command-line invocation is probably your best bet.

bimalm commented 7 years ago

For the previous functionality, I do an ugly quick trick. tail -f /var/log/logstash/logstash-plain.log & Then do logstash config check in the same window. Since it throw the log output in realtime to the console, you will get the feeling that previous functionality is still there. ;)

truthadjustr commented 6 years ago

logstash -t -f /path/to/file.conf or logstash --config.test_and_exit -f /path/to/file.conf works in my logstash:5.5.1