Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Log parsing rules in Jenkins

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: /
like image 894
Arun Avatar asked Jun 17 '13 07:06

Arun


1 Answers

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.

like image 155
Kobi Avatar answered Nov 14 '22 16:11

Kobi