• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • logstash-plugin
    • None

      wiki payload shows "result" in the payload, but its not in the output for any of mine.

      https://wiki.jenkins.io/display/JENKINS/Logstash+Plugin

      payload formatted with logstash (final redacted JSON payload attached `a`):

      input {
        udp {
          port => 5555
          type => cee
        }
      }
      
      filter {
        if [type] == "cee" {
          grok {
            match => {
              "message" => "<%{NONNEGINT:syslog_pri}>%{NONNEGINT:version}%{SPACE}(?:-|%{TIMESTAMP_ISO8601:syslog_timestamp})%{SPACE}(?:-|%{IPORHOST:hostname})%{SPACE}(?:%{SYSLOG5424PRINTASCII:program}|-)%{SPACE}(?:-|%{SYSLOG5424PRINTASCII:process_id})%{SPACE}(?:-|%{SYSLOG5424PRINTASCII:message_id})%{SPACE}(?:-|(?<structured_data>(\[.*?[^\\]\])+))(?:%{SPACE}@cee: %{GREEDYDATA:syslog_message}|)"
            }
            add_tag => "%{program}"
          }
          mutate {
            replace => [ "@source", "ecs" ]
          }
          json {
            source => "syslog_message"
            target => "syslog_message"
          }
          if ![fields][class] {
            mutate {
              add_field => { "[fields][class]" => "jenkins" }
            }
          }
        }
      
      }
      
      output {
        elasticsearch {
          hosts => ["${ELASTICSEARCH_HOST:localhost}:${ELASTICSEARCH_PORT:9200}"]
          ssl => true
          index => "%{[fields][class]}-%{+YYYY.MM.dd}"
          user => "${ELASTICSEARCH_USER:elastic}"
          password => "${ELASTICSEARCH_PASSWORD:changeme}"
        }   
      }
      
      

          [JENKINS-49114] Does not output "result"

          The example was generated for old-style (what is the collective term for non-pipeline?) jobs. Can you check the output from a freestyle build?

          Jakub Bochenski added a comment - The example was generated for old-style (what is the collective term for non-pipeline?) jobs. Can you check the output from a freestyle build?

          marc young added a comment -

          I cant use a freestyle build, this is for Github organizations using scripted (Jenkinsfile)

          marc young added a comment - I cant use a freestyle build, this is for Github organizations using scripted (Jenkinsfile)

          Markus Winter added a comment -

          when the build result is not yet set when the logstashSend step is called, the result is not included.

          You might want to wrap everything in a try catch block

          see https://support.cloudbees.com/hc/en-us/articles/218554077-How-to-set-current-build-result-in-Pipeline-

          afterwards call the logstashSend (note that this step requires a node to run)

          Markus Winter added a comment - when the build result is not yet set when the logstashSend step is called, the result is not included. You might want to wrap everything in a try catch block see https://support.cloudbees.com/hc/en-us/articles/218554077-How-to-set-current-build-result-in-Pipeline- afterwards call the logstashSend (note that this step requires a node to run)

            jbochenski Jakub Bochenski
            myoung34 marc young
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: