Add config file output to --configtest

This only works when the `--debug` flag is also enabled.

fixes #3243

Changes to log formatting per request

Change :file to :config_file

:file gets overridden by `logstash/agent.rb`, so a different symbol
is necessary.  Changing to `:config_file`

Fixes #4182
This commit is contained in:
Aaron Mildenstein 2015-11-12 11:04:25 -07:00 committed by Jordan Sissel
parent ebb5ed71cc
commit d514ba550f

View file

@ -312,19 +312,27 @@ class LogStash::Agent < Clamp::Command
Dir.glob(path).sort.each do |file|
next unless File.file?(file)
if file.match(/~$/)
@logger.debug("NOT reading config file because it is a temp file", :file => file)
@logger.debug("NOT reading config file because it is a temp file", :config_file => file)
next
end
@logger.debug("Reading config file", :file => file)
@logger.debug("Reading config file", :config_file => file)
cfg = File.read(file)
if !cfg.ascii_only? && !cfg.valid_encoding?
encoding_issue_files << file
end
config << cfg + "\n"
if config_test?
@logger.debug? && @logger.debug("\nThe following is the content of a file", :config_file => file.to_s)
@logger.debug? && @logger.debug("\n" + cfg + "\n\n")
end
end
if (encoding_issue_files.any?)
fail("The following config files contains non-ascii characters but are not UTF-8 encoded #{encoding_issue_files}")
end
if config_test?
@logger.debug? && @logger.debug("\nThe following is the merged configuration")
@logger.debug? && @logger.debug("\n" + config + "\n\n")
end
return config
end # def load_config