【问题标题】:jenkins logstash-plugin unable to post to elasticSearchjenkins logstash-plugin 无法发布到 elasticSearch
【发布时间】:2016-03-30 21:10:37
【问题描述】:

我已经为 jenkins 安装了 logstash-plugin 并将其配置为使用索引器作为弹性搜索。

在执行作业时,我看到以下错误:

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)

希望能提供有关如何修复此错误的任何线索。

谢谢 - 普拉特克

【问题讨论】:

    标签: elasticsearch jenkins logstash jenkins-plugins


    【解决方案1】:

    在 Jenkins 插件中,您需要定义包含 [yourindex]/[yourtype] 的 elasticsearch url,如下所示: http://localhost:9200/yourindex/yourtype 希望对您有所帮助。

    【讨论】:

    • 您好,先生,我正在尝试将日志直接发送到 Elasticsearch。我的弹性是由 aws 的弹性搜索服务创建的,我找不到用于在 jenkins logstash 插件中配置好 url 的端口。同样对于索引,我应该把我想要创建的那个放在我的 els 中吗?谢谢。
    【解决方案2】:

    您是否尝试使用 Logstash 将日志提供给 Elasticsearch?尽管被称为“Logstash 插件”,但 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

    然后将 Jenkins 中的 Elasticsearch url 设置为 http://:7590/

    希望有帮助!

    【讨论】:

      猜你喜欢
      • 2022-10-20
      • 1970-01-01
      • 2017-09-22
      • 1970-01-01
      • 2015-10-27
      • 2015-08-10
      • 1970-01-01
      • 2013-02-13
      • 2016-10-15
      相关资源
      最近更新 更多