Jenkins Logstash Plugin

Travis: Build Status Jenkins: Build Status

This plugin adds support for sending a job's console log to Logstash indexers such as Elastic Search, Logstash, RabbitMQ, Redis or to Syslog.

  • use Jira to report issues / feature requests


  • Search for 'Logstash' in your Jenkins plugin manager


Supported methods of input/output:

  • ElasticSearch (REST API)
  • Logstash TCP input
  • Redis (format => 'json_event')
  • RabbitMQ (mechanism => PLAIN)
  • Syslog (format => cee/json (RFC-5424,RFC-3164), protocol => UDP)



Logstash plugin can be used as a publisher in pipeline jobs to send the tail of the log as a single document.

Example for publisher in pipeline

node('master') {
        echo 'Hello, world!'
    logstashSend failBuild: true, maxLines: 1000

Note: Due to the way logging works in pipeline currently, the logstashSend step might not transfer the lines logged directly before the step is called. Adding a sleep of 1 second might help here.

Note: In order to get the the result set in pipeline it must be set before the logstashSend step.

Note: the logstashSend step requires a node to run.

Step with Block

It can be used as a wrapper step to send each log line separately.

Once the result is set, it will appear in the data sent to the indexer.

Note: when you combine with timestamps step, you should make the timestamps the outermost block. Otherwise you get the timestamps as part of the log lines, basically duplicating the timestamp information.

Example for pipeline step

timestamps {
  logstash {
    node('somelabel') {
        echo 'Hello, World!'
      try {
        // do something that fails
        sh "exit 1"
        currentBuild.result = 'SUCCESS'
      } catch (Exception err) {
        currentBuild.result = 'FAILURE'

Note: Information on which agent the steps are executed is not available at the moment.

Enable Globally

You can enable this plugin globally in the Jenkins system configuration page, or with the configuration as code plugin:

    enableGlobally: true
    enabled: true
            host: "localhost"
            port: 9200


This component streams individual log lines to the indexer for post-processing, along with any build data that is available at the start (some information such as the build status is unavailable or incomplete).

Post-Build Publisher

This component pushes the tail of the job's log to the indexer for post-processing, along with all build data at the time the post-build action had started (if any post-build actions are scheduled after this plugin they will not be recorded).

JSON Payload Format

Example payload sent to the indexer (e.g. RabbitMQ) using the post-build action component.

Note 1: when the build wrapper is used, some information such as the build result will be missing or incomplete, and the "message" array will contain a single log line.

Note 2: data.testResults will only be present if a publisher records your test results in the build, for example by using the JUnit Plugin.

Click to expand the JSON payload
      "fullDisplayName":"My Example Job #1",
      "Started by user anonymous",
      "Building in workspace /var/lib/jenkins/jobs/my_example_job/workspace",
      "Hello, World!"


See Changelog.


The Logstash Plugin is licensed under the MIT License.


  • Fork the project on Github
  • Make your feature addition or bug fix, write tests, commit.
  • Send me a pull request. Bonus points for topic branches.

Adding support for new indexers

  • Implement the extension point jenkins.plugins.logstash.configuration.LogstashIndexer that will take your configuration.
  • Implement equals() and hashCode()so the plugin can compare new configuration with existing configuration.
  • Create a configure-advanced.jelly for the UI part of your configuration.
  • Create a help.jelly with more details about indexer.
  • Create a new class that extends jenkins.plugins.logstash.persistence.AbstractLogstashIndexerDao or jenkins.plugins.logstash.persistence.HostBasedLogstashIndexer. This class will do the actual work of pushing the logs to the indexer.