2016-03-30 64 views
1

我已經安裝了jenkins的logstash-plugin並將其配置爲使用索引器作爲彈性搜索。jenkins logstash-plugin無法發佈到elasticSearch

在執行我看到以下錯誤的作業:

16:56:12 [logstash-plugin]: Failed to send log data to ELASTICSEARCH:http://localhost:9200. 
16:56:12 [logstash-plugin]: No Further logs will be sent to http://localhost:9200. 
16:56:12 java.io.IOException: HTTP error code: 200 
16:56:12 URI: http://localhost:9200/logstash-jenkins 
16:56:12 RESPONSE: HttpResponseProxy{HTTP/1.1 200 OK [Content-Type:  application/json; charset=UTF-8, Content-Length: 21] ResponseEntityProxy{[Content-Type: application/json; charset=UTF-8,Content-Length: 21,Chunked: false]}} 
16:56:12 {"acknowledged":true} 
16:56:12 at jenkins.plugins.logstash.persistence.ElasticSearchDao.push(ElasticSearchDao.java:113) 
16:56:12 at jenkins.plugins.logstash.LogstashWriter.write(LogstashWriter.java:147) 
16:56:12 at jenkins.plugins.logstash.LogstashWriter.write(LogstashWriter.java:85) 
16:56:12 at jenkins.plugins.logstash.LogstashOutputStream.eol(LogstashOutputStream.java:58) 
16:56:12 at hudson.console.LineTransformationOutputStream.eol(LineTransformationOutputStream.java:60) 
16:56:12 at hudson.console.LineTransformationOutputStream.write(LineTransformationOutputStream.java:56) 
16:56:12 at hudson.console.LineTransformationOutputStream.write(LineTransformationOutputStream.java:74) 
16:56:12 at java.io.PrintStream.write(PrintStream.java:480) 
16:56:12 at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221) 
16:56:12 at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291) 
16:56:12 at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:104) 
16:56:12 at  java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:185) 
16:56:12 at java.io.PrintStream.newLine(PrintStream.java:546) 
16:56:12 at java.io.PrintStream.println(PrintStream.java:807) 
16:56:12 at hudson.model.Cause$UserIdCause.print(Cause.java:426) 
16:56:12 at  hudson.model.StreamBuildListener.started(StreamBuildListener.java:75) 
16:56:12 at hudson.model.Run.execute(Run.java:1723) 
16:56:12 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) 
16:56:12 at  hudson.model.ResourceController.execute(ResourceController.java:98) 
16:56:12 at hudson.model.Executor.run(Executor.java:410) 

想知道關於我如何可以解決此錯誤的線索。

感謝 - Prateek

回答

1

在詹金斯插件,你需要定義一個包含[yourindex]/[yourtype]如下elasticsearch網址: http://localhost:9200/yourindex/yourtype 希望它能幫助。

+0

幫助。謝謝! –

+0

嗨,先生,我想直接發送日誌到Elasticsearch。我的彈性是由aws的elasticsearch服務創建的,我無法找到什麼端口用於配置jenkins logstash插件中的url。同樣對於索引,我應該把我想要在我的els中創建的那個?謝謝。 – DionysoSong

0

您是否試圖使用Logstash將日誌輸入Elasticsearch?儘管被稱爲'Logstash Plugin',但Jenkins Logstash插件不支持這一點。我發現,當我試圖直接發送日誌到Elasticsearch時,插件工作正常,但是當我試圖通過Logstash時,我得到了和您一樣的錯誤。

目前Jenkins Logstash github中有一個拉取請求來修復這個錯誤(https://github.com/jenkinsci/logstash-plugin/pull/22),但由於該插件在10個月內沒有被激活(寫作時),我沒有多少希望。

如果你想直接發送日誌到Elasticsearch,你需要配置Elasticsearch來監聽遠程連接。設置在elasticsearch.yml如下:

network.host:0.0.0.0 http.port:7590

然後設置Elasticsearch網址在詹金斯到http://:7590/

希望這有幫助!