Configuring Proxy in HTTP OUT Plugin

  • Version: 7.3
  • Operating System: Windows 10
  • Config File (if you have sensitive info, please remove it):

I tried three options to configure proxy for http out plugin.
All these are not working, Please provide some input.
#proxy => {"host" => 10.17.168.224", "port" => 3128, "scheme" => 'http', "user" => 'test', "password" => 'test'}

#proxy => "https://test:test123@10.17.168.224:3128/"

"proxy" : {
"host" : "10.17.168.224",
"port" : "3128",
"scheme" : "http",
"user" : "test,
"password" : "test"
}

Every time i am unable to push the data .

What error do you get?

Proxy Config 1:

http {
http_method => "post"
url => "http://server.net/ingestion"
format => "message"
headers => {"Content-Type" => "application/json"}
content_type => "application/json"
message => '%{message}'
pool_max => 100
pool_max_per_route => 100
proxy => {host => "10.17.168.224", port => 3128, scheme => 'http', user => 'test', password => 'test'}
}

Error:

[2019-08-13T03:45:09,850][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:srm_test_pl, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of #, {, } at line 112, column 46 (byte 5238) after output {\r\n\r\n file {\r\n path => "{RDBCOLLECTOR_LOGSTASH_HOME}/{RDBCOLLECTOR_CONTAINER_NAME}/test/test_info_{RDBCOLLECTOR_JDBC_HOST}.json\"\r\n write_behavior => overwrite\r\n }\r\n if ( !([@metadata][ingestIntoJarvis] == \"true\") ) { \r\n #elasticsearch {\r\n # hosts => \"{ES_HTTP_HOSTS}"\r\n # index => "test_1"\r\n # document_id => "%{test_unique_key}"\r\n # document_type => "data"\r\n #}\r\n }\r\n else { \r\n http {\r\n http_method => "post"\r\n url => "http://server.net/ingestion"\r\n format => "message"\r\n headers => {"Content-Type" => "application/json"}\r\n content_type => "application/json"\r\n message => '%{message}'\r\n pool_max => 100\r\n pool_max_per_route => 100\r\n proxy => {host => "10.17.168.224"", :backtrace=>["C:/logstash-7.2.0/logstash-core/lib/logstash/compiler.rb:41:in compile_imperative'", "C:/logstash-7.2.0/logstash-core/lib/logstash/compiler.rb:49:incompile_graph'", "C:/logstash-7.2.0/logstash-core/lib/logstash/compiler.rb:11:in block in compile_sources'", "org/jruby/RubyArray.java:2577:inmap'", "C:/logstash-7.2.0/logstash-core/lib/logstash/compiler.rb:10:in compile_sources'", "org/logstash/execution/AbstractPipelineExt.java:151:ininitialize'", "org/logstash/execution/JavaBasePipelineExt.java:47:in initialize'", "C:/logstash-7.2.0/logstash-core/lib/logstash/java_pipeline.rb:24:ininitialize'", "C:/logstash-7.2.0/logstash-core/lib/logstash/pipeline_action/create.rb:36:in execute'", "C:/logstash-7.2.0/logstash-core/lib/logstash/agent.rb:325:inblock in converge_state'"]}

Proxy config 2:

http {
http_method => "post"
url => "http://server.net/ingestion"
format => "message"
headers => {"Content-Type" => "application/json"}
content_type => "application/json"
message => '%{message}'
pool_max => 100
pool_max_per_route => 100
"proxy" : {
"host" : "10.17.168.224",
"port" : "3128",
"scheme" : "http",
"user" : "test,
"password" : "test"
}
}

Error:

Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:srm_test_pl, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of #, => at line 112, column 21 (byte 5213) after output {\r\n\r\n file {\r\n path => "{RDBCOLLECTOR_LOGSTASH_HOME}/{RDBCOLLECTOR_CONTAINER_NAME}/test/test_info_{RDBCOLLECTOR_JDBC_HOST}.json\"\r\n write_behavior => overwrite\r\n }\r\n if ( !([@metadata][ingestIntoJarvis] == \"true\") ) { \r\n #elasticsearch {\r\n # hosts => \"{ES_HTTP_HOSTS}"\r\n # index => "test_1"\r\n # document_id => "%{test_unique_key}"\r\n # document_type => "data"\r\n #}\r\n }\r\n else { \r\n http {\r\n http_method => "post"\r\n url => "http://server.net/ingestion"\r\n format => "message"\r\n headers => {"Content-Type" => "application/json"}\r\n content_type => "application/json"\r\n message => '%{message}'\r\n pool_max => 100\r\n pool_max_per_route => 100\r\n "proxy" ", :backtrace=>["C:/logstash-7.2.0/logstash-core/lib/logstash/compiler.rb:41:in compile_imperative'", "C:/logstash-7.2.0/logstash-core/lib/logstash/compiler.rb:49:incompile_graph'", "C:/logstash-7.2.0/logstash-core/lib/logstash/compiler.rb:11:in block in compile_sources'", "org/jruby/RubyArray.java:2577:inmap'", "C:/logstash-7.2.0/logstash-core/lib/logstash/compiler.rb:10:in compile_sources'", "org/logstash/execution/AbstractPipelineExt.java:151:ininitialize'", "org/logstash/execution/JavaBasePipelineExt.java:47:in initialize'", "C:/logstash-7.2.0/logstash-core/lib/logstash/java_pipeline.rb:24:ininitialize'", "C:/logstash-7.2.0/logstash-core/lib/logstash/pipeline_action/create.rb:36:in execute'", "C:/logstash-7.2.0/logstash-core/lib/logstash/agent.rb:325:inblock in converge_state'"]}

I know the documentation says to use a comma between entries. The documentation is wrong. Just use the usual hash notation.

 proxy => {host => "10.17.168.224" port => 80 scheme => 'http' user => 'username@host' password => 'password'}