From 705ad54443f984bbbbf403cff251d61f4fc7fddb Mon Sep 17 00:00:00 2001 From: Joao Duarte Date: Tue, 17 Jan 2017 10:13:18 +0000 Subject: [PATCH] improve user facing error when yaml is incorrect Fixes #6546 --- logstash-core/lib/logstash/runner.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/logstash-core/lib/logstash/runner.rb b/logstash-core/lib/logstash/runner.rb index eeed1eb6b..78d291829 100644 --- a/logstash-core/lib/logstash/runner.rb +++ b/logstash-core/lib/logstash/runner.rb @@ -170,7 +170,12 @@ class LogStash::Runner < Clamp::StrictCommand rescue => e # abort unless we're just looking for the help unless cli_help?(args) - $stderr.puts "ERROR: Failed to load settings file from \"path.settings\". Aborting... path.setting=#{LogStash::SETTINGS.get("path.settings")}, exception=#{e.class}, message=>#{e.message}" + if e.kind_of?(Psych::Exception) + yaml_file_path = ::File.join(LogStash::SETTINGS.get("path.settings"), "logstash.yml") + $stderr.puts "ERROR: Failed to parse YAML file \"#{yaml_file_path}\". Please confirm if the YAML structure is valid (e.g. look for incorrect usage of whitespace or indentation). Aborting... parser_error=>#{e.message}" + else + $stderr.puts "ERROR: Failed to load settings file from \"path.settings\". Aborting... path.setting=#{LogStash::SETTINGS.get("path.settings")}, exception=#{e.class}, message=>#{e.message}" + end return 1 end end