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

Log Parser Plugin does not parse Pipeline console outputs

      Versions:

      • Jenkins: 1.644
      • Workflow plugins: 1.12
      • Log Parser Plugin: 2.0

      Issue:
      I have the following workflow job:

      node {
         step([$class: 'LogParserPublisher', parsingRulesPath: '/var/lib/jenkins/jenkins-rule-logparser', useProjectRule: false])
         echo 'Error: oh no'
      }
      

      and it produces the following console output:

      Started by user anonymous
      [Workflow] Allocate node : Start
      Running on master in /var/lib/jenkins/jobs/ntsvc-monitor-dev/workspace
      [Workflow] node {
      [Workflow] step
      [Workflow] echo
      Error: oh noes
      [Workflow] } //node
      [Workflow] Allocate node : End
      [Workflow] End of Workflow
      Finished: SUCCESS
      

      The log parser config (/var/lib/jenkins/jenkins-rule-logparser) is:

      error /Error/
      

      The parsed log view shows only:

      Started by user anonymous
      [Workflow] Allocate node : Start
      Running on master in /var/lib/jenkins/jobs/ntsvc-monitor-dev/workspace
      [Workflow] node {
      

      For a FreeStyle job, the same echo message and log parser rules, results in fully parsed log and the error message is detected/colored red. See attachments for views of parsed log screens.

      The Jenkins system log does not contain errors for the jobs or the Log Parse plugin... indeed, it contains success messages from the Log Parse plugin.

          [JENKINS-32866] Log Parser Plugin does not parse Pipeline console outputs

          Jeff Burke created issue -

          Jeff Burke added a comment -

          Screen shots of parse working and not working.

          Jeff Burke added a comment - Screen shots of parse working and not working.
          Jeff Burke made changes -
          Attachment New: parsed-freestyle.png [ 31823 ]
          Attachment New: parsed-workflow.png [ 31824 ]
          Jeff Burke made changes -
          Description Original: Versions:
          * Jenkins: 1.644
          * Workflow plugins: 1.12
          * Log Parser Plugin: 2.0

          Issue:
          I have the following workflow job:
          {code:java}
          node {
             step([$class: 'LogParserPublisher', parsingRulesPath: '/var/lib/jenkins/jenkins-rule-logparser', useProjectRule: false])
             echo 'Error: oh no'
          }
          {code}

          and it produces the following console output:
          {noformat}
          Started by user anonymous
          [Workflow] Allocate node : Start
          Running on master in /var/lib/jenkins/jobs/ntsvc-monitor-dev/workspace
          [Workflow] node {
          [Workflow] step
          [Workflow] echo
          Error: oh noes
          [Workflow] } //node
          [Workflow] Allocate node : End
          [Workflow] End of Workflow
          Finished: SUCCESS
          {noformat}

          The log parser config (/var/lib/jenkins/jenkins-rule-logparser) is:
          {noformat}
          error /Error/
          {noformat}

          The parsed log view shows only:
          {noformat}
          Started by user anonymous
          [Workflow] Allocate node : Start
          Running on master in /var/lib/jenkins/jobs/ntsvc-monitor-dev/workspace
          [Workflow] node {
          {noformat}

          For a FreeStyle job, the same echo message and log parser rules, results in fully parsed log and the error message is detected/colored red. See attachments for views of parsed log screens.

          New: Versions:
          * Jenkins: 1.644
          * Workflow plugins: 1.12
          * Log Parser Plugin: 2.0

          Issue:
          I have the following workflow job:
          {code:java}
          node {
             step([$class: 'LogParserPublisher', parsingRulesPath: '/var/lib/jenkins/jenkins-rule-logparser', useProjectRule: false])
             echo 'Error: oh no'
          }
          {code}

          and it produces the following console output:
          {noformat}
          Started by user anonymous
          [Workflow] Allocate node : Start
          Running on master in /var/lib/jenkins/jobs/ntsvc-monitor-dev/workspace
          [Workflow] node {
          [Workflow] step
          [Workflow] echo
          Error: oh noes
          [Workflow] } //node
          [Workflow] Allocate node : End
          [Workflow] End of Workflow
          Finished: SUCCESS
          {noformat}

          The log parser config (/var/lib/jenkins/jenkins-rule-logparser) is:
          {noformat}
          error /Error/
          {noformat}

          The parsed log view shows only:
          {noformat}
          Started by user anonymous
          [Workflow] Allocate node : Start
          Running on master in /var/lib/jenkins/jobs/ntsvc-monitor-dev/workspace
          [Workflow] node {
          {noformat}

          For a FreeStyle job, the same echo message and log parser rules, results in fully parsed log and the error message is detected/colored red. See attachments for views of parsed log screens.

          The Jenkins system log does not contain errors for the jobs or the Log Parse plugin... indeed, it contains success messages from the Log Parse plugin.

          Manuel Recena Soto made changes -
          Labels New: pipeline
          Manuel Recena Soto made changes -
          Summary Original: Log Parser Plugin does not parse workflow console outputs New: Log Parser Plugin does not parse Pipeline console outputs
          Jesse Glick made changes -
          Labels Original: pipeline New: workflow

          Sorin Sbarnea added a comment -

          Is this working? It would be quite useful to enable it for pipelines, we are all moving to them now.

          Sorin Sbarnea added a comment - Is this working? It would be quite useful to enable it for pipelines, we are all moving to them now.

          IMHO this is the expected behavior. The log parser step only has access to the log to the point where it is called. If called in "finally" (as some sort of post build actions in the pipeline build) this works well:

          try {
            node {
                 echo 'Error: oh no'
            }
          } finally {
            node {
             step([$class: 'LogParserPublisher', parsingRulesPath: '/var/lib/jenkins/jenkins-rule-logparser', useProjectRule: false])
            }
          }
          

          In order to fail the build add "failBuildOnError: true" (and maybe you need another try/catch block around the log parser step to catch the error and set the build result to FAILURE explicitly (not tested)).

          Christoph Vogtländer added a comment - IMHO this is the expected behavior. The log parser step only has access to the log to the point where it is called. If called in "finally" (as some sort of post build actions in the pipeline build) this works well: try { node { echo 'Error: oh no' } } finally { node { step([$class: 'LogParserPublisher' , parsingRulesPath: '/ var /lib/jenkins/jenkins-rule-logparser' , useProjectRule: false ]) } } In order to fail the build add "failBuildOnError: true" (and maybe you need another try/catch block around the log parser step to catch the error and set the build result to FAILURE explicitly (not tested)).
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 168563 ] New: JNJira + In-Review [ 183178 ]

            mreinhardt Martin Reinhardt
            potatopankakes Jeff Burke
            Votes:
            13 Vote for this issue
            Watchers:
            20 Start watching this issue

              Created:
              Updated:
              Resolved: