logstash 使用 http_poll 未在 kibana 仪表板中创建索引模式。错误 -LogStash::ConfigurationError", :message=>"应为 #,
index pattern is not creating in kibana dahboard by logstash using http_poll. error -LogStash::ConfigurationError", :message=>"Expected one of #,
我想从 logstash 调用其余部分 api 并想将其发送到弹性搜索以在 kibana 中显示数据 dashboard.but 我收到错误 -
[2019-12-23T16:55:24,887][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of #, => at line 14, column 25 (byte 243) after output {\r\nelasticsearch{\r\nhosts=>{\"localhost:9200\"", :backtrace=>["D:/elasticinstall/logstash-7.4.0/logstash-core/lib/logstash/compiler.rb:41:in `compile_imperative'", "D:/elasticinstall/logstash-7.4.0/logstash-core/lib/logstash/compiler.rb:49:in `compile_graph'", "D:/elasticinstall/logstash-7.4.0/logstash-core/lib/logstash/compiler.rb:11:in `block in compile_sources'", "org/jruby/RubyArray.java:2584:in `map'", "D:/elasticinstall/logstash-7.4.0/logstash-core/lib/logstash/compiler.rb:10:in `compile_sources'", "org/logstash/execution/AbstractPipelineExt.java:153:in `initialize'", "org/logstash/execution/JavaBasePipelineExt.java:47:in `initialize'", "D:/elasticinstall/logstash-7.4.0/logstash-core/lib/logstash/java_pipeline.rb:26:in `initialize'", "D:/elasticinstall/logstash-7.4.0/logstash-core/lib/logstash/pipeline_action/create.rb:36:in `execute'", "D:/elasticinstall/logstash-7.4.0/logstash-core/lib/logstash/agent.rb:326:in `block in converge_state'"]}
[2019-12-23T16:55:25,982][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[2019-12-23T16:55:30,292][INFO ][logstash.runner ] Logstash shut down.
logstash code
input {
http_poller {
urls => {
urlname =>"http://.."
}
}
request_timeout => 60
schedule => {every=>"20s"}
codec => "line"
}
}
output {
elasticsearch{
hosts=>{"localhost:9200"}
index =>"logstash_http_poller"
}
stdout {
codec => rubydebug
}
}
来自 powershell 的命令
logstash -f logstash_http_poller.conf
你的 elasticsearch
输出是错误的,你不需要在主机周围加上花括号:
elasticsearch {
hosts => "localhost:9200" <-- change this
index => "logstash_http_poller"
}
input {
http_poller {
urls =>
{
test1 => "rest api url"
}
request_timeout => 60
# Supports "cron", "every", "at" and "in" schedules by rufus scheduler
schedule => { cron => "* * * * * UTC"}
codec => "json"
# A hash of request metadata info (timing, response headers, etc.) will be sent here
metadata_target => "http_poller_metadata"
}
}
output {
stdout {
codec => rubydebug
}
}
我想从 logstash 调用其余部分 api 并想将其发送到弹性搜索以在 kibana 中显示数据 dashboard.but 我收到错误 -
[2019-12-23T16:55:24,887][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of #, => at line 14, column 25 (byte 243) after output {\r\nelasticsearch{\r\nhosts=>{\"localhost:9200\"", :backtrace=>["D:/elasticinstall/logstash-7.4.0/logstash-core/lib/logstash/compiler.rb:41:in `compile_imperative'", "D:/elasticinstall/logstash-7.4.0/logstash-core/lib/logstash/compiler.rb:49:in `compile_graph'", "D:/elasticinstall/logstash-7.4.0/logstash-core/lib/logstash/compiler.rb:11:in `block in compile_sources'", "org/jruby/RubyArray.java:2584:in `map'", "D:/elasticinstall/logstash-7.4.0/logstash-core/lib/logstash/compiler.rb:10:in `compile_sources'", "org/logstash/execution/AbstractPipelineExt.java:153:in `initialize'", "org/logstash/execution/JavaBasePipelineExt.java:47:in `initialize'", "D:/elasticinstall/logstash-7.4.0/logstash-core/lib/logstash/java_pipeline.rb:26:in `initialize'", "D:/elasticinstall/logstash-7.4.0/logstash-core/lib/logstash/pipeline_action/create.rb:36:in `execute'", "D:/elasticinstall/logstash-7.4.0/logstash-core/lib/logstash/agent.rb:326:in `block in converge_state'"]}
[2019-12-23T16:55:25,982][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[2019-12-23T16:55:30,292][INFO ][logstash.runner ] Logstash shut down.
logstash code
input {
http_poller {
urls => {
urlname =>"http://.."
}
}
request_timeout => 60
schedule => {every=>"20s"}
codec => "line"
}
}
output {
elasticsearch{
hosts=>{"localhost:9200"}
index =>"logstash_http_poller"
}
stdout {
codec => rubydebug
}
}
来自 powershell 的命令 logstash -f logstash_http_poller.conf
你的 elasticsearch
输出是错误的,你不需要在主机周围加上花括号:
elasticsearch {
hosts => "localhost:9200" <-- change this
index => "logstash_http_poller"
}
input {
http_poller {
urls =>
{
test1 => "rest api url"
}
request_timeout => 60
# Supports "cron", "every", "at" and "in" schedules by rufus scheduler
schedule => { cron => "* * * * * UTC"}
codec => "json"
# A hash of request metadata info (timing, response headers, etc.) will be sent here
metadata_target => "http_poller_metadata"
}
}
output {
stdout {
codec => rubydebug
}
}