LogStash conf file help

Hi,

I have created a logstash conf file. It's just bare bones, trying to get the service up and running so I can practice on my PC. This is what's in the file.
`input {

`stdin {}

`}

`output{

`elasticsearch { hosts => ["localhost:9200"] }

`index => "indexforlogstash"

`}

the issue is on command prompt I'm running logstash -f C:\path\logstash.conf
but I get the following error.
"Using bundled JDK: ""
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
ERROR: Unknown command 'Search\logstash-7.12.1\bin\logstash.conf'

See: 'bin/logstash --help'
[FATAL] 2021-05-21 14:12:58.338 [main] Logstash - Logstash stopped processing because of an error: (SystemExit) exit
org.jruby.exceptions.SystemExit: (SystemExit) exit
at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:747) ~[jruby-complete-9.2.13.0.jar:?]
at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:710) ~[jruby-complete-9.2.13.0.jar:?]
at C_3a_.Elastic_20_Search.logstash_minus_7_dot_12_dot_1.vendor.bundle.jruby.$2_dot_5_dot_0.gems.clamp_minus_0_dot_6_dot_5.lib.clamp.command.run(C:/Elastic Search/logstash-7.12.1/vendor/bundle/jruby/2.5.0/gems/clamp-0.6.5/lib/clamp/command.rb:137) ~[?:?]
at C_3a_.Elastic_20_Search.logstash_minus_7_dot_12_dot_1.lib.bootstrap.environment.(C:\Elastic Search\logstash-7.12.1\lib\bootstrap\environment.rb:88) ~[?:?]

is it not finding my conf file? do I need a different version of Java?
Any help would be appreciated. Thanks

Is there a space in the path portion of the filename?

Hi Badger,

Yes, there is a space in the path portion of the filename.

Then you need quotes around the entire filename

logstash -f "/Program Files.../bin/logstash.conf"

Thank You Badger, that let me proceed. Unfortunately, I still run into another error.

C:\Elastic Search\logstash-7.12.1\bin>logstash -f "C:\Elastic Search\logstash-7.12.1\bin\logstash.conf"
"Using bundled JDK: ""
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Sending Logstash logs to C:/Elastic Search/logstash-7.12.1/logs which is now configured via log4j2.properties
[2021-05-21T15:23:16,109][INFO ][logstash.runner          ] Log4j configuration path used is: C:\Elastic Search\logstash-7.12.1\config\log4j2.properties
[2021-05-21T15:23:16,120][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"7.12.1", "jruby.version"=>"jruby 9.2.13.0 (2.5.7) 2020-08-03 9a89c94bcc OpenJDK 64-Bit Server VM 11.0.10+9 on 11.0.10+9 +indy +jit [mswin32-x86_64]"}
[2021-05-21T15:23:16,217][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2021-05-21T15:23:17,018][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}
[2021-05-21T15:23:17,162][ERROR][logstash.agent           ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of [ \\t\\r\\n], \"#\", \"{\" at line 7, column 7 (byte 87) after output{\r\nelasticsearch { hosts => [\"localhost:9200\"] }\r\nindex ", :backtrace=>["C:/Elastic Search/logstash-7.12.1/logstash-core/lib/logstash/compiler.rb:32:in `compile_imperative'", "org/logstash/execution/AbstractPipelineExt.java:184:in `initialize'", "org/logstash/execution/JavaBasePipelineExt.java:69:in `initialize'", "C:/Elastic Search/logstash-7.12.1/logstash-core/lib/logstash/java_pipeline.rb:47:in `initialize'", "C:/Elastic Search/logstash-7.12.1/logstash-core/lib/logstash/pipeline_action/create.rb:52:in `execute'", "C:/Elastic Search/logstash-7.12.1/logstash-core/lib/logstash/agent.rb:389:in `block in converge_state'"]}
[2021-05-21T15:23:17,266][INFO ][logstash.runner          ] Logstash shut down.
[2021-05-21T15:23:17,275][FATAL][org.logstash.Logstash    ] Logstash stopped processing because of an error: (SystemExit) exit
org.jruby.exceptions.SystemExit: (SystemExit) exit
        at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:747) ~[jruby-complete-9.2.13.0.jar:?]
        at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:710) ~[jruby-complete-9.2.13.0.jar:?]
        at C_3a_.Elastic_20_Search.logstash_minus_7_dot_12_dot_1.lib.bootstrap.environment.<main>(C:\Elastic Search\logstash-7.12.1\lib\bootstrap\environment.rb:89) ~[?:?]``
output{
elasticsearch { hosts => [\"localhost:9200\"] }
index

The } at the end of the elasticsearch line ends the configuration of elasticsearch. You will need to move it further down your configuration. It should be

output{
    elasticsearch { 
        hosts => ["localhost:9200"] 
        index => "indexforlogstash"
    }
}
1 Like

Thank you, that worked.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.