Ensure config-string matches the real defaults

Since the defaults are constant strings, ensure the `I18n` text uses the
same defaults as does the Ruby code

Also, update the comment about line length to match the "55" that is
both correct and used further down in the file.

Fixes #1456
This commit is contained in:
Matthew L Daniel 2015-07-22 12:49:12 -07:00 committed by Jordan Sissel
parent 5e73c47600
commit cf49aab8b4
2 changed files with 17 additions and 9 deletions

View file

@ -7,12 +7,16 @@ require "net/http"
LogStash::Environment.load_locale!
class LogStash::Agent < Clamp::Command
DEFAULT_INPUT = "input { stdin { type => stdin } }"
DEFAULT_OUTPUT = "output { stdout { codec => rubydebug } }"
option ["-f", "--config"], "CONFIG_PATH",
I18n.t("logstash.agent.flag.config"),
:attribute_name => :config_path
option "-e", "CONFIG_STRING",
I18n.t("logstash.agent.flag.config-string"),
I18n.t("logstash.agent.flag.config-string",
:default_input => DEFAULT_INPUT, :default_output => DEFAULT_OUTPUT),
:default => "", :attribute_name => :config_string
option ["-w", "--filterworkers"], "COUNT",
@ -102,11 +106,11 @@ class LogStash::Agent < Clamp::Command
else
# include a default stdin input if no inputs given
if @config_string !~ /input *{/
@config_string += "input { stdin { type => stdin } }"
@config_string += DEFAULT_INPUT
end
# include a default stdout output if no outputs given
if @config_string !~ /output *{/
@config_string += "output { stdout { codec => rubydebug } }"
@config_string += DEFAULT_OUTPUT
end
end

View file

@ -128,7 +128,7 @@ en:
This is often a permissions issue, or the wrong
path was specified?
flag:
# Note: Wrap these at 45 chars so they display nicely when clamp emits
# Note: Wrap these at 55 chars so they display nicely when clamp emits
# them in an 80-character terminal
config: |+
Load the logstash config from a specific file
@ -141,12 +141,16 @@ en:
config-string: |+
Use the given string as the configuration
data. Same syntax as the config file. If no
input is specified, then 'stdin
{ type => stdin }' is the default input.
If no output is specified, then 'stdout
{ codec => rubydebug } }' is default output.
input is specified, then the following is
used as the default input:
"%{default_input}"
and if no output is specified, then the
following is used as the default output:
"%{default_output}"
If you wish to use both defaults, please use
the empty string for the '-e' flag.
configtest: |+
Check configuration, then exit.
Check configuration for valid syntax and then exit.
filterworkers: |+
Sets the number of filter workers to run.
watchdog-timeout: |+