title: Jenkins Logstash plugin doesn't send data to Logstash
body: <p>I want to use Jenkins-Logstash plugin to send Jenkins logs to Logstash.</p>
  
  <p>This is how I configured Logstash plugin in Jenkins:</p>
  
  <p>[jenkins-logstash-plugin configuration][1]   [1]:    <a href="https://i.stack.imgur.com/EsIgY.png" rel="nofollow noreferrer">https://i.stack.imgur.com/EsIgY.png</a></p>
  
  <p>I assume in logstash.conf I have to use HTTP plugin in input section:</p>
  
  <pre><code>input {
    http {
      host =&gt; "127.0.0.1"
      port =&gt; 31311
    }
  }
  </code></pre>
  
  <p>But in Jenkins build logs I can see the error:</p>
  
  <pre><code>&gt; [logstash-plugin]: Failed to send log data to
  &gt; ELASTICSEARCH:http://host_name:31311. [logstash-plugin]: No Further
  &gt; logs will be sent to http://host_name:31311.
  &gt; org.apache.http.conn.HttpHostConnectException: Connect to
  &gt; host_name:31311 [/host_name] failed: Connection refused (Connection
  &gt; refused)  at
  &gt; org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
  &gt;   at
  &gt; org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
  &gt; ... 
  &gt; Caused by: java.net.ConnectException: Connection refused
  &gt; (Connection refused)  at java.net.PlainSocketImpl.socketConnect(Native
  &gt; Method)   at
  &gt; java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
  </code></pre>
  
  <p>And the error is gone when I change port number in Jenkins config to Elasticsearch port <code>9200</code> instead of <code>31311</code>. But in this case data is written directly to Elasticsearch.</p>
  
  <p>How can I set Jenkins to send build logs to Logstash?</p>
  
  <p><strong>Update</strong>:
  I am able to send and get logs in Logstash now, everything works good. But in Jenkins console I can see the error when sending logs to Logstash, is it acceptable?</p>
  
  <pre><code>20:54:11 [logstash-plugin]: Failed to send log data to ELASTICSEARCH:host_name:31311.
  20:54:11 [logstash-plugin]: No Further logs will be sent to host_name:31311.
  20:54:11 java.io.IOException: HTTP error code: 200
  20:54:11 URI: host_name:31311/jenkins-qa/type
  20:54:11 RESPONSE: HttpResponseProxy{HTTP/1.1 200 OK [Content-Type: text/plain, Content-Length: 2] ResponseEntityProxy{[Content-Type: text/plain,Content-Length: 2,Chunked: false]}}
  20:54:11 ok
  20:54:11    at jenkins.plugins.logstash.persistence.ElasticSearchDao.push(ElasticSearchDao.java:113)
  20:54:11    at jenkins.plugins.logstash.LogstashWriter.write(LogstashWriter.java:147)
  20:54:11    at jenkins.plugins.logstash.LogstashWriter.writeBuildLog(LogstashWriter.java:116)
  20:54:11    at jenkins.plugins.logstash.LogstashNotifier.perform(LogstashNotifier.java:63)
  20:54:11    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
  20:54:11    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
  20:54:11    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
  20:54:11    at hudson.model.Build$BuildExecution.post2(Build.java:186)
  20:54:11    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
  20:54:11    at hudson.model.Run.execute(Run.java:1753)
  20:54:11    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
  20:54:11    at hudson.model.ResourceController.execute(ResourceController.java:98)
  20:54:11    at hudson.model.Executor.run(Executor.java:405)
  20:54:11 Finished: SUCCESS
  </code></pre>