尝试将 Logstash 配置为使用 LS_JAVA_OPTS 的代理,但它似乎不起作用
Trying to configure Logstash to use a proxy with LS_JAVA_OPTS but it doesn't seem to work
Elastic 在 Azure 中的 Windows Server 2012 R2 VM 上 运行。
VM1:运行 在 Hyper-V 我的工作站上 Windows Server 2012 R2。无代理
VM2:在 Windows Server 2012 R2 的受保护域中设置;需要代理
我的 Logstash 配置 (my.config) 具有以下输出定义:
elasticsearch
{
host => "myhost.cloudapp.net"
cluster => "mycluster"
document_type => "%{type}"
index => "%{index}_%{+YYYY.MM.dd}"
template_name => "%{index}"
document_id => "%{id}"
protocol => "http"
}
VM1 可以很好地将数据加载到 Elastic Search 主机中
我从 VM1 压缩了 logstash 文件夹并将其复制到 VM2 并解压缩。然后我创建了一个 start.bat 文件,它被放置在 \logstash\bin
cls
SET JAVA_HOME=D:\JDK
SET LS_JAVA_OPTS=-Dhttp.proxyHost=myproxy.mydomain.com -Dhttp.proxyPort=8080
logstash.bat agent -f my.conf
当 运行 在 VM2 上执行此操作时,在命令提示符 window 中生成以下内容:
io/console not supported; tty will not be manipulated
Failed to install template: connect timed out {:level=>:error}
Logstash startup completed
Got error to send bulk of actions: connect timed out {:level=>:error}
Failed to flush outgoing items {:outgoing_count=>1, :exception=>#<Manticore::Timeout: connect timed out>,
:backtrace=>["D:/LogStash/vendor/bundle/jruby/1.9/gems/manticore-0.4.1-java/lib/manticore/response.rb:35:in `initialize'",
"org/jruby/RubyProc.java:271:in `call'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/manticore-0.4.1-java/lib/manticore/response.rb:61:in `call'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/manticore-0.4.1-java/lib/manticore/response.rb:225:in `call_once'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/manticore-0.4.1-java/lib/manticore/response.rb:128:in `code'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/elasticsearch-transport-1.0.12/lib/elasticsearch/transport/transport/http/manticore.rb:71:in `perform_request'",
"org/jruby/RubyProc.java:271:in `call'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/elasticsearch-transport-1.0.12/lib/elasticsearch/transport/transport/base.rb:190:in `perform_request'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/elasticsearch-transport-1.0.12/lib/elasticsearch/transport/transport/http/manticore.rb:54:in `perform_request'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/elasticsearch-transport-1.0.12/lib/elasticsearch/transport/client.rb:119:in `perform_request'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/elasticsearch-api-1.0.12/lib/elasticsearch/api/actions/bulk.rb:80:in `bulk'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-1.0.1-java/lib/logstash/outputs/elasticsearch/protocol.rb:103:in `bulk'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-1.0.1-java/lib/logstash/outputs/elasticsearch.rb:505:in `submit'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-1.0.1-java/lib/logstash/outputs/elasticsearch.rb:529:in `flush'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/stud-0.0.20/lib/stud/buffer.rb:219:in `buffer_flush'",
"org/jruby/RubyHash.java:1341:in `each'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/stud-0.0.20/lib/stud/buffer.rb:216:in `buffer_flush'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/stud-0.0.20/lib/stud/buffer.rb:112:in `buffer_initialize'",
"org/jruby/RubyKernel.java:1511:in `loop'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/stud-0.0.20/lib/stud/buffer.rb:110:in `buffer_initialize'"], :level=>:warn}
我用 Logstash v1.5.0 试过了。我将 VM2 中的 logstash 版本更新为 v1.5.2,但这似乎没有帮助。
我进入 "Configure Java" GUI 并在网络设置下设置代理,但没有帮助。我也在使用 JDK 版本 1.8.0_45-b15.
我也试过使用 http 输出插件,也没有用。这是它的 logstash 配置:
http
{
http_method => "post"
url => "http://myhost.cloudapp.net/myindex/mytype"
}
我遇到的错误是(只复制了下面的异常消息)。
:response=>nil, :exception=>#<Errno::EBADF: Bad file descriptor - Bad file descriptor>
可能值得一提的是,我可以使用 Mozilla 和 Internet Explorer 访问 Marvel Sense 插件,并可以向 Elastic Search 集群发出请求。这是来自 fiddler 的示例请求 header:
GET http://myhost.cloudapp.net:9200/_cat/indices?_=1436330129174 HTTP/1.1
Referer: http://myhost.cloudapp.net:9200/_plugin/marvel/sense/index.html
Accept: text/plain, */*; q=0.01
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
Host: xirtes.cloudapp.net:9200
Proxy-Connection: Keep-Alive
如有任何帮助,我们将不胜感激。
尝试:
输出 {
弹性搜索{
index => "%{index}_%{+YYYY.MM.dd}"
主机 => "myhost.cloudapp.net"
端口=>“9200”
协议=> http
idle_flush_time => 1
flush_size => 5000
}
}
与 elasticsearch 的好心人交谈,他们确认 LogStash 目前不支持转发代理。但是,已提出添加此功能的新请求 (https://github.com/logstash-plugins/logstash-output-elasticsearch/issues/199)
他们建议同时使用反向代理(如果可能的话)。
Elastic 在 Azure 中的 Windows Server 2012 R2 VM 上 运行。 VM1:运行 在 Hyper-V 我的工作站上 Windows Server 2012 R2。无代理 VM2:在 Windows Server 2012 R2 的受保护域中设置;需要代理
我的 Logstash 配置 (my.config) 具有以下输出定义:
elasticsearch
{
host => "myhost.cloudapp.net"
cluster => "mycluster"
document_type => "%{type}"
index => "%{index}_%{+YYYY.MM.dd}"
template_name => "%{index}"
document_id => "%{id}"
protocol => "http"
}
VM1 可以很好地将数据加载到 Elastic Search 主机中 我从 VM1 压缩了 logstash 文件夹并将其复制到 VM2 并解压缩。然后我创建了一个 start.bat 文件,它被放置在 \logstash\bin
cls
SET JAVA_HOME=D:\JDK
SET LS_JAVA_OPTS=-Dhttp.proxyHost=myproxy.mydomain.com -Dhttp.proxyPort=8080
logstash.bat agent -f my.conf
当 运行 在 VM2 上执行此操作时,在命令提示符 window 中生成以下内容:
io/console not supported; tty will not be manipulated
Failed to install template: connect timed out {:level=>:error}
Logstash startup completed
Got error to send bulk of actions: connect timed out {:level=>:error}
Failed to flush outgoing items {:outgoing_count=>1, :exception=>#<Manticore::Timeout: connect timed out>,
:backtrace=>["D:/LogStash/vendor/bundle/jruby/1.9/gems/manticore-0.4.1-java/lib/manticore/response.rb:35:in `initialize'",
"org/jruby/RubyProc.java:271:in `call'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/manticore-0.4.1-java/lib/manticore/response.rb:61:in `call'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/manticore-0.4.1-java/lib/manticore/response.rb:225:in `call_once'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/manticore-0.4.1-java/lib/manticore/response.rb:128:in `code'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/elasticsearch-transport-1.0.12/lib/elasticsearch/transport/transport/http/manticore.rb:71:in `perform_request'",
"org/jruby/RubyProc.java:271:in `call'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/elasticsearch-transport-1.0.12/lib/elasticsearch/transport/transport/base.rb:190:in `perform_request'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/elasticsearch-transport-1.0.12/lib/elasticsearch/transport/transport/http/manticore.rb:54:in `perform_request'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/elasticsearch-transport-1.0.12/lib/elasticsearch/transport/client.rb:119:in `perform_request'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/elasticsearch-api-1.0.12/lib/elasticsearch/api/actions/bulk.rb:80:in `bulk'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-1.0.1-java/lib/logstash/outputs/elasticsearch/protocol.rb:103:in `bulk'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-1.0.1-java/lib/logstash/outputs/elasticsearch.rb:505:in `submit'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-1.0.1-java/lib/logstash/outputs/elasticsearch.rb:529:in `flush'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/stud-0.0.20/lib/stud/buffer.rb:219:in `buffer_flush'",
"org/jruby/RubyHash.java:1341:in `each'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/stud-0.0.20/lib/stud/buffer.rb:216:in `buffer_flush'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/stud-0.0.20/lib/stud/buffer.rb:112:in `buffer_initialize'",
"org/jruby/RubyKernel.java:1511:in `loop'",
"D:/LogStash/vendor/bundle/jruby/1.9/gems/stud-0.0.20/lib/stud/buffer.rb:110:in `buffer_initialize'"], :level=>:warn}
我用 Logstash v1.5.0 试过了。我将 VM2 中的 logstash 版本更新为 v1.5.2,但这似乎没有帮助。
我进入 "Configure Java" GUI 并在网络设置下设置代理,但没有帮助。我也在使用 JDK 版本 1.8.0_45-b15.
我也试过使用 http 输出插件,也没有用。这是它的 logstash 配置:
http
{
http_method => "post"
url => "http://myhost.cloudapp.net/myindex/mytype"
}
我遇到的错误是(只复制了下面的异常消息)。
:response=>nil, :exception=>#<Errno::EBADF: Bad file descriptor - Bad file descriptor>
可能值得一提的是,我可以使用 Mozilla 和 Internet Explorer 访问 Marvel Sense 插件,并可以向 Elastic Search 集群发出请求。这是来自 fiddler 的示例请求 header:
GET http://myhost.cloudapp.net:9200/_cat/indices?_=1436330129174 HTTP/1.1
Referer: http://myhost.cloudapp.net:9200/_plugin/marvel/sense/index.html
Accept: text/plain, */*; q=0.01
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
Host: xirtes.cloudapp.net:9200
Proxy-Connection: Keep-Alive
如有任何帮助,我们将不胜感激。
尝试:
输出 {
弹性搜索{
index => "%{index}_%{+YYYY.MM.dd}"
主机 => "myhost.cloudapp.net"
端口=>“9200”
协议=> http
idle_flush_time => 1
flush_size => 5000
}
}
与 elasticsearch 的好心人交谈,他们确认 LogStash 目前不支持转发代理。但是,已提出添加此功能的新请求 (https://github.com/logstash-plugins/logstash-output-elasticsearch/issues/199)
他们建议同时使用反向代理(如果可能的话)。