Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-52048

Add arbitrary tags to wrapper logs

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      While it's nice to be able to use the Logstash plugin as both a post-build shipper or a step wrapper, there's very little on which to filter in Kibana to distinguish documents shipped by different steps. It would be really simple yet helpful for the wrapper to accept an argument to tag logs shipped by that step with a specific value.

      For example:

      logstash('my tag name') {
        // do stuff here
      }
      

       

      This would ship a document with a custom field (let's call it 'myTag' for simplicity) which would be populated by the string argument passed into the pipeline step. In Kibana, I would then filter for logs from just that step with

      data.myTag.keyword:"my tag name"

       

      Multiple tags could also be added by passing more than one string argument:

      logstash('first tag', myStringMethod(), "Tag number ${env.BUILD_NUMBER}") {
        // this step has multiple searchable tags
        // data.myTag.keyword:("first tag" OR "result of string method" OR "Tag number 3")
      }
      

       

       

        Attachments

          Activity

          Hide
          jbochenski Jakub Bochenski added a comment -

          There is an open PR aiming to enable custom script processing of the data being sent, maybe you can check if it would fit your needs? https://github.com/jenkinsci/logstash-plugin/pull/71

          Show
          jbochenski Jakub Bochenski added a comment - There is an open PR aiming to enable custom script processing of the data being sent, maybe you can check if it would fit your needs? https://github.com/jenkinsci/logstash-plugin/pull/71

            People

            Assignee:
            jbochenski Jakub Bochenski
            Reporter:
            jlahr John Lahr
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: