title: How to configure jenkins pipeline with logstash plugin?
body: <p>Usecase: I want to send jenkins job console log to elasticsearch, from there to kibana so that i can visualise the data. </p>
  
  <p>I am using logstash plugin to achieve this. For freestyle job logstash plugin configuration is working fine but for jenkins pipeline jobs I am getting all required data like build number, job name, build duration and all but it is not showing the build result i.e., success or failure it is not showing.</p>
  
  <p>I tried in two ways:
  1.</p>
  
  <pre><code> stage('send to ES') {
         logstashSend failBuild: true, maxLines: -1
  }
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>timestamps {
    logstash {
      node() {
        sh'''
          echo 'Hello, World!'
        '''
        try {
          stage('GitSCM')
      {
          git url: 'github repo.git'
      }
      stage('Initialize')
      {
  
          jdk = tool name: 'jdk'
          env.JAVA_HOME = "${jdk}"
          echo "jdk installation path is: ${jdk}"
          sh "${jdk}/bin/java -version"
          sh '$JAVA_HOME/bin/java -version'
          def mvnHome = tool 'mvn'
      }
  
       stage('Build Stage')
      {
          def mvnHome = tool 'mvn'
          sh "${mvnHome}/bin/mvn -B verify"
      }
          currentBuild.result = 'SUCCESS'
        } catch (Exception err) {
          currentBuild.result = 'FAILURE'
        }    
      }
    }
  }
  </code></pre>
  
  <p>But in both ways I am not getting build result i.e., success or failure in my elasticsearch or kibana.
  Can someone help.</p>