Hi all,
Can any guide me to create file configuration logstash with API? I've been using this syntax but i found error.
input {
http_poller {
urls => {
users = {
method => get
url => "https://api.id/api/categories"
headers => {
"Content-Type" => "application/json"
Authorization => "bearer token"
}
}
}
request_timeout => 60
schedule => { "every" => "20s"}
codec => "json"
type => "Http_poller"
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "users"
}
stdout { codec => rubydebug }
}
This the error
C:\ELK>logstash -f users.conf
Sending Logstash logs to C:/ELK/logstash-7.9.2/logs which is now configured via log4j2.properties
[2020-11-03T10:22:31,929][INFO ][logstash.runner ] Starting Logstash {"logstash.version"=>"7.9.2", "jruby.version"=>"jruby 9.2.13.0 (2.5.7) 2020-08-03 9a89c94bcc Java HotSpot(TM) 64-Bit Server VM 25.261-b12 on 1.8.0_261-b12 +indy +jit [mswin32-x86_64]"}
[2020-11-03T10:22:33,013][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2020-11-03T10:22:35,892][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 4, column 19 (byte 62) after input {\r\nhttp_poller {\r\n urls => {\r\n users ", :backtrace=>["C:/ELK/logstash-7.9.2/logstash-core/lib/logstash/compiler.rb:32:in compile_imperative'", "org/logstash/execution/AbstractPipelineExt.java:183:in
initialize'", "org/logstash/execution/JavaBasePipelineExt.java:69:in initialize'", "C:/ELK/logstash-7.9.2/logstash-core/lib/logstash/java_pipeline.rb:44:in
initialize'", "C:/ELK/logstash-7.9.2/logstash-core/lib/logstash/pipeline_action/create.rb:52:in execute'", "C:/ELK/logstash-7.9.2/logstash-core/lib/logstash/agent.rb:357:in
block in converge_state'"]}
[2020-11-03T10:22:37,508][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[2020-11-03T10:22:41,175][INFO ][logstash.runner ] Logstash shut down.
[2020-11-03T10:22:41,217][ERROR][org.logstash.Logstash ] java.lang.IllegalStateException: Logstash stopped processing because of an error: (SystemExit) exit
Thanks