Logstash docker error -> exception=>"LogStash::ConfigurationError", :message=>"Expected one of [ \\t\\r\\n], \"#\", \"input\", \"filter\", \"output\" at line 1, column 1 (byte 1)"

Hi,
I am facing a peculiar issue. I have seen the error faced by many before me, but the solution (only a few of them said resolved by fresh creation by typing the logstash.conf file) is not working for me.

Please help.

I am trying to run following command...

docker run --rm -it -v "$(pwd)"/pipeline/:/usr/share/logstash/pipeline/ docker.elastic.co/logstash/logstash-oss:7.10.0

This actually behave exactly similar way for litlle older version like 7.9.3 as well.

my logstash.conf file in a subdirectory /config of current directory (from where I fired this command) has following lines.....
input{
tcp {
port => 5044
codec => json
type => logstash
}
}
output{
elasticsearch {
hosts => "elasticsearch-elkpoc:80"
index => "%{type}-%{+YYYY.MM.DD}"
}
}

This resulted out with the following error....
LogStash::ConfigurationError", :message=>"Expected one of [ \t\r\n], "#", "input", "filter", "output" at line 1, column 1 (byte 1)"

The error remains same even if I reduce the logstash.conf to
input{} output{} filter{}

Entire error message below...
Using bundled JDK: /usr/share/logstash/jdk
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jruby.ext.openssl.SecurityHelper (file:/tmp/jruby-1/jruby17367836674706560272jopenssl.jar) to field java.security.MessageDigest.provider
WARNING: Please consider reporting this to the maintainers of org.jruby.ext.openssl.SecurityHelper
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Sending Logstash logs to /usr/share/logstash/logs which is now configured via log4j2.properties
[2020-11-12T11:55:37,170][INFO ][logstash.runner ] Starting Logstash {"logstash.version"=>"7.10.0", "jruby.version"=>"jruby 9.2.13.0 (2.5.7) 2020-08-03 9a89c94bcc OpenJDK 64-Bit Server VM 11.0.8+10 on 11.0.8+10 +indy +jit [linux-x86_64]"}
[2020-11-12T11:55:37,357][INFO ][logstash.setting.writabledirectory] Creating directory {:setting=>"path.queue", :path=>"/usr/share/logstash/data/queue"}
[2020-11-12T11:55:37,392][INFO ][logstash.setting.writabledirectory] Creating directory {:setting=>"path.dead_letter_queue", :path=>"/usr/share/logstash/data/dead_letter_queue"}
[2020-11-12T11:55:38,302][INFO ][logstash.agent ] No persistent UUID file found. Generating new UUID {:uuid=>"97d3f9dd-7c24-4649-a056-04a9901f1b87", :path=>"/usr/share/logstash/data/uuid"}
[2020-11-12T11:55:41,024][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of [ \t\r\n], "#", "input", "filter", "output" at line 1, column 1 (byte 1)", :backtrace=>["/usr/share/logstash/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'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:47:in initialize'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:52:in execute'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:365:in block in converge_state'"]}
[2020-11-12T11:55:41,602][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[2020-11-12T11:55:46,368][INFO ][logstash.runner ] Logstash shut down.
[2020-11-12T11:55:46,421][ERROR][org.logstash.Logstash ] java.lang.IllegalStateException: Logstash stopped processing because of an error: (SystemExit) exit

1 Like

Please use the proper format of the conf:

input {
   tcp {
   port => 5044
   codec => json
   type => logstash
   }
}

filter {
}

output {
   elasticsearch {
   hosts => "elasticsearch-elkpoc:80"
   index => "%{type}-%{+YYYY.MM.DD}"
   }
}
1 Like

thanks it helped

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