Jenkins Log Parser plugin instructions for use

Source: Internet
Author: User

Official wiki: https://wiki.jenkins-ci.org/display/JENKINS/Log+Parser+Plugin
Plug-in summary information: Parse the console output and highlight the error/warning/info line.
Description: The log-parser plugin parses the console log generated by the Jenkins build. The parsing console log provides the following functions:
Highlight interesting log (error, warning, info) lines
Divide the log into chunks
Display a summary of the total number of errors/warnings/infomations lines in the log and its blocks
Link errors/warnings/infomations summary to the context of the full log, making it easier to find the log lines of interest
Show errors/warnings summary on the build page
Parsing log example:
Summary of the build level: Display errors/warnings summary on the build page

Parsed log: The following is an example of a constructed parsing log, which can be accessed by clicking the "Parsed Console Output" link in the left sidebar of the build page.

The left side of the report can be expanded to browse the errors/warning/info lines. These lines are linked to the full log on the right and are easy to find. Clicking on an error will take you to its full log on the right.

  Configuration Multiple parsing rules can be configured at the global level.
Global configuration
Parsing rule options What appears in the global Jenkins configuration is the logical name (project, description, etc.) of the "Console Output Parsing" node and the configuration pair of the parsing rule file. Later, when a job configures log parsing, you can select a configuration item that implements the parsing rules for the job.
For each parsing rule option, specify: Parsing rule name: logical name, which will be displayed as an option in the job-level configuration. Parsing rule file: The file that implements the parsing rule in this option. (For more information, see "Parsing rules files")
Parsing rules file Each line of the file specifies a level (ok/error/warn/info/start) and a regular expression limited by "/" to find the line that marks the matching level.
ok/error/warn
Used to identify the problem line.
info
These lines are highlighted in blue in the report. They are used to create a series of links to reports for quick access to specific areas.
start
Like the info lines, these lines are also highlighted in blue in the report and displayed as a series of quick access links. In addition, they are used to group a series of errors and warnings found in that area.

For example, in the parsing rules file, the following line means that the line containing the word "ERROR" is marked as an error line:
error /ERROR/
Case-insensitive matching
Matching symbols support Java regular expressions to embed tag expressions. To perform a case-insensitive match, use (?i) notation.
Example: To match the line starting with the case-insensitive word ‘error’, use:
error /(?i)^error /
If a row matches multiple rules, the first rule is applied.
So for the following series of rules:
ok /^javadoc:/
error /Error/
And the following line exists in the build log:

javadoc: Error: could not find something
This line will be considered "ok" and will not be highlighted as an error because the ^javadoc: pattern is matched first.

Lines starting with "#" and blank lines will be ignored

Examples of parsing rule files are as follows:
ok /not really/

# match line starting with ‘error ‘, case-insensitive
error /(?i)^error /

# list of warnings here...
warning /[Ww]arning/
warning /WARNING/

# create a quick access link to lines in the report containing ‘INFO’
info /INFO/

# each line containing ‘BUILD’ represents the start of a section for grouping errors and warnings found after the line.
# also creates a quick access link.
start /BUILD/


Job configuration
Click the menu: Jenkins -> job name -> Configure
Locate the Post-build Actions area
Check the "Console output (build log) parsing" checkbox
"Mark build Unstable on Warning" option: After checking, parse out warnings and build the mark as ‘Unstable’ status
"Mark build Failed on Error" option: Check to parse out errors and build the mark as ‘Failed’ status
"Select Parsing Rules": Select the rules used to parse logs in the job construction
(Note: This list is obtained from the global configuration)


Jenkins Log Parser Plugin Instructions


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.