Log parsing rules in Jenkins

10,169

The Log Parser Plugin does not support spaces in your pattern.

This can be clearly seen in their source code:

final String ruleParts[] = parsingRule.split("\\s");
String regexp = ruleParts[1];

They should probably have used .split("\\s", 2).

As an alternative, you can use \s, \b, or an escape sequence - \u0020.

Share:
10,169
Arun
Author by

Arun

Updated on June 28, 2022

Comments

  • Arun
    Arun almost 2 years

    I'm using Jenkins log parser plugin to extract and display the build log. The rule file looks like,

     # Compiler Error
     error /(?i) error:/
    
     # Compiler Warning
     warning /(?i) warning:/
    

    Everything works fine but for some reasons, at the end of "Parsed Output Console", I see this message,

    NOTE: Some bad parsing rules have been found:
    
    Bad parsing rule: , Error:1
    Bad parsing rule: , Error:1
    

    This, I'm sure is a trivial issue but not able to figure it out at this moment. Please help :)

    EDIT: Based on Kobi's answer and having looked into the "Parsing rules files", I fixed it this way (a single space after colon). This worked perfectly as expected.

    # Compiler Error
    error /(?i)error: /
    
    # Compiler Warning
    warning /(?i)warning: /