Logstash shuts down after a few seconds

Hi, i'm using Logstash 7.6.0 and i am trying to make a function where i read logs on port 3003. to do so i installed the http output plugin and created a file called plugin.conf in /usr/share/logstash/config as so:
output {
http {
url => "127.0.0.1:3003"
http_method => "post"
}
}
and on port 3003 there is gonna be another script listening.
i start logstash through the command
/usr/share/logstash/bin/logstash -f /usr/share/logstash/config/
but after 5 seconds logstash suts down with this error:

[ERROR] 2020-02-27 09:10:38.782 [Converge PipelineAction::Create] 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:47:in compile_imperative'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:55:in compile_graph'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:17:in block in compile_sources'", "org/jruby/RubyArray.java:2580:in map'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:14:in compile_sources'", "org/logstash/execution/AbstractPipelineExt.java:161:in initialize'", "org/logstash/execution/JavaBasePipelineExt.java:47:in initialize'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:27:in initialize'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:36:in execute'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:326:in block in converge_state'"]}
[INFO ] 2020-02-27 09:10:39.001 [Api Webserver] agent - Successfully started Logstash API endpoint {:port=>9600}
[INFO ] 2020-02-27 09:10:44.058 [LogStash::Runner] runner - Logstash shut down.

i copied in the config folder all the other config files in /etc/logstash/conf.d also, and tested each of them with
/usr/share/logstash/bin/logstash --config.test_and_exit -f /usr/share/logstash/config/configfile.conf
resulting all of them OK.
Since it seems an easy configuration, i find weird that logstash shuts down after 5 seconds. If i run logstash throught service logstash start the service run normally but doesn't do the job, can anybody help me?

Your logstash configuration file should at least have a block input and another bock output.

thank you! with this configuration is working, i post it just in case someone else needs it
input {
beats {
port => 5044
}
http {
port => 5043
}
}
output {
elasticsearch {
manage_template => false
index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
}
http {
url => "http://127.0.0.1:3003"
http_method => "post"
}
file {
path => "/home/sysadmin/test.log"
}
}

Enjoy ! :grinning:

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