logstashのoutput.httpにあるproxyをconfを変更せずに外部から動的に変更したいと考えています。
現在以下設定で試したのですがエラーが発生して上手くいきません。
良い方法はないでしょうか?
よろしくお願いいたします。
input {
stdin{}
}
filter {
environment {
add_metadata_from_env => {"proxysrv" => "ProxySrv"}
}
}
output {
stdout{
codec => rubydebug {metadata => true}
}
http {
http_method => "post"
url => "http://xxx.xxx.xxx.xxx:80"
http_compression => true
proxy => "%{[@metadata][proxysrv]}"
}
}
エラーは以下の通りです。
[2019-07-22T19:58:21,760][ERROR][logstash.outputs.http ] Error in http output loop {:class=>"URI::InvalidURIError", :message=>"bad URI(is not URI?): %{[@metadata][proxysrv]}", :backtrace=>["uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/uri/rfc3986_parser.rb:67:in
split'", "uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/uri/rfc3986_parser.rb:73:in
parse'", "uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/uri/common.rb:227:inparse'", "C:/Users/test/Desktop/logstash/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:521:in
get_proxy_host'", "C:/Users/test/Desktop/logstash/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:187:ininitialize'", "C:/Users/test/Desktop/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-mixin-http_client-6.0.1/lib/logstash/plugin_mixins/http_client.rb:180:in
make_client'", "C:/Users/test/Desktop/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-mixin-http_client-6.0.1/lib/logstash/plugin_mixins/http_client.rb:185:inclient'", "C:/Users/test/Desktop/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-http-5.2.2/lib/logstash/outputs/http.rb:240:in
send_event'", "C:/Users/test/Desktop/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-http-5.2.2/lib/logstash/outputs/http.rb:175:insend_events'", "C:/Users/test/Desktop/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-http-5.2.2/lib/logstash/outputs/http.rb:124:in
multi_receive'", "org/logstash/config/ir/compiler/OutputStrategyExt.java:114:inmulti_receive'", "org/logstash/config/ir/compiler/AbstractOutputDelegatorExt.java:97:in
multi_receive'", "C:/Users/test/Desktop/logstash/logstash-core/lib/logstash/pipeline.rb:372:inblock in output_batch'", "org/jruby/RubyHash.java:1343:in
each'", "C:/Users/test/Desktop/logstash/logstash-core/lib/logstash/pipeline.rb:371:inoutput_batch'", "C:/Users/test/Desktop/logstash/logstash-core/lib/logstash/pipeline.rb:323:in
worker_loop'", "C:/Users/test/Desktop/logstash/logstash-core/lib/logstash/pipeline.rb:285:inblock in start_workers'"]} [2019-07-22T19:58:21,938][FATAL][logstash.runner ] An unexpected error occurred! {:error=>#<URI::InvalidURIError: bad URI(is not URI?): %{[@metadata][proxysrv]}>, :backtrace=>["uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/uri/rfc3986_parser.rb:67:in
split'", "uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/uri/rfc3986_parser.rb:73:inparse'", "uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/uri/common.rb:227:in
parse'", "C:/Users/test/Desktop/logstash/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:521:inget_proxy_host'", "C:/Users/test/Desktop/logstash/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.4-java/lib/manticore/client.rb:187:in
initialize'", "C:/Users/test/Desktop/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-mixin-http_client-6.0.1/lib/logstash/plugin_mixins/http_client.rb:180:inmake_client'", "C:/Users/test/Desktop/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-mixin-http_client-6.0.1/lib/logstash/plugin_mixins/http_client.rb:185:in
client'", "C:/Users/test/Desktop/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-http-5.2.2/lib/logstash/outputs/http.rb:240:insend_event'", "C:/Users/test/Desktop/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-http-5.2.2/lib/logstash/outputs/http.rb:175:in
send_events'", "C:/Users/test/Desktop/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-http-5.2.2/lib/logstash/outputs/http.rb:124:inmulti_receive'", "org/logstash/config/ir/compiler/OutputStrategyExt.java:114:in
multi_receive'", "org/logstash/config/ir/compiler/AbstractOutputDelegatorExt.java:97:inmulti_receive'", "C:/Users/test/Desktop/logstash/logstash-core/lib/logstash/pipeline.rb:372:in
block in output_batch'", "org/jruby/RubyHash.java:1343:ineach'", "C:/Users/test/Desktop/logstash/logstash-core/lib/logstash/pipeline.rb:371:in
output_batch'", "C:/Users/test/Desktop/logstash/logstash-core/lib/logstash/pipeline.rb:323:inworker_loop'", "C:/Users/test/Desktop/logstash/logstash-core/lib/logstash/pipeline.rb:285:in
block in start_workers'"]}
[2019-07-22T19:58:22,094][ERROR][org.logstash.Logstash ] java.lang.IllegalStateException: Logstash stopped processing because of an error: (SystemExit) exit