How can I filter only errors in Jenkins-email-ext, BUILD_LOG_REGEX?

I am currently using BUILD_LOG_REGEX in Jenkins Editable Email to get an error log via email. But I get a lot of garbage, and I want to filter out errors, and I want the error log to be filtered out to perfection. Any help?

+6
source share
1 answer

Your question is rather non-specific. As Yusuo Ohtonen notes in the commentary, what you do depends on what you usually find in your journal. Here is an example of what we use in one of our tasks, quite general (if not minimalistic):

${BUILD_LOG_REGEX, regex="^.*?BUILD FAILED.*?$", linesBefore=0, linesAfter=10, maxMatches=5, showTruncatedLines=false, escapeHtml=true} 

I would suggest the following: create a task that writes text containing the types of errors that you encounter (you can just pop out some text file that you put in the workspace of the task), and then play with Java regular expression patterns - java.util.regex.Pattern - in the Plugin, until you get the desired result. Make sure that you send emails from work only for yourself :)

To use custom HTML, here is a quote from the link to the plugin token:

 ${JELLY_SCRIPT, template} - Custom message content generated from a Jelly script template. There are two templates provided: "html" and "text". Custom Jelly templates should be placed in $JENKINS_HOME/email-templates. When using custom templates, the template filename without ".jelly" should be used for the "template" argument. template - the template name. Defaults to "html". 

The default template that you can use as a starting point is in

 $JENKINS_HOME/plugins/email-ext/WEB-INF/classes/hudson/plugins/emailext/templates/html.jelly 
+8
source

Source: https://habr.com/ru/post/909317/


All Articles