|
19 | 19 |
|
20 | 20 | class LogStash::Runner < Clamp::StrictCommand
|
21 | 21 | include LogStash::Util::Loggable
|
22 |
| - # The `path.settings` need to be defined in the runner instead of the `logstash-core/lib/logstash/environment.rb` |
| 22 | + # The `path.settings` and `path.logs` need to be defined in the runner instead of the `logstash-core/lib/logstash/environment.rb` |
23 | 23 | # because the `Environment::LOGSTASH_HOME` doesn't exist in the context of the `logstash-core` gem.
|
24 | 24 | #
|
25 | 25 | # See issue https://github.com/elastic/logstash/issues/5361
|
26 | 26 | LogStash::SETTINGS.register(LogStash::Setting::String.new("path.settings", ::File.join(LogStash::Environment::LOGSTASH_HOME, "config")))
|
| 27 | + LogStash::SETTINGS.register(LogStash::Setting::String.new("path.logs", ::File.join(LogStash::Environment::LOGSTASH_HOME, "logs"))) |
27 | 28 |
|
28 | 29 | # Node Settings
|
29 | 30 | option ["-n", "--node.name"], "NAME",
|
@@ -77,9 +78,10 @@ class LogStash::Runner < Clamp::StrictCommand
|
77 | 78 | :default => LogStash::SETTINGS.get_default("path.plugins")
|
78 | 79 |
|
79 | 80 | # Logging Settings
|
80 |
| - option ["-l", "--path.log"], "FILE", |
| 81 | + option ["-l", "--path.logs"], "PATH", |
81 | 82 | I18n.t("logstash.runner.flag.log"),
|
82 |
| - :attribute_name => "path.log" |
| 83 | + :attribute_name => "path.logs", |
| 84 | + :default => LogStash::SETTINGS.get_default("path.logs") |
83 | 85 |
|
84 | 86 | option "--log.level", "LEVEL", I18n.t("logstash.runner.flag.log_level"),
|
85 | 87 | :default => LogStash::SETTINGS.get_default("log.level"),
|
@@ -172,8 +174,9 @@ def run(args)
|
172 | 174 | # Configure Logstash logging facility, this need to be done before everything else to
|
173 | 175 | # make sure the logger has the correct settings and the log level is correctly defined.
|
174 | 176 | # TODO(talevy): cleanly support `path.logs` setting in log4j
|
| 177 | + java.lang.System.setProperty("ls.logs", setting("path.logs")) |
175 | 178 | unless java.lang.System.getProperty("log4j.configurationFile")
|
176 |
| - log4j_config_location = setting("path.settings") + "/log4j2.properties" |
| 179 | + log4j_config_location = ::File.join(setting("path.settings"), "log4j2.properties") |
177 | 180 | LogStash::Logging::Logger::initialize(log4j_config_location)
|
178 | 181 | end
|
179 | 182 |
|
|
0 commit comments