I am new to jenkins. I am trying to add a new line in my jenkins log console to display the Application name with its sub-component like (Datamax - Crawler) so that i can run a query on entire jenkins log files and filter out using sed/awk to get application name
I tried using log parser plugin where i change Global Configuration (/jenkins/configure). There is a section "Console Output Parsing". In description i put, for example, : "Rules1" and in "Parsing Rules File" - "This is for Application: Datamax-Crawler".
And then, i tried updating jenkinsfile at the end of the pipeline in the post phase.
post {
always {
logParser ([
projectRulePath: 'Rules1',
parsingRulesPath: '',
showGraphs: true,
unstableOnWarning: true,
useProjectRule: true
])
emailext (
to: 'xxx@xxx.com',
attachLog: 'true',
replyTo: '$DEFAULT_REPLYTO',
subject: '$DEFAULT_SUBJECT',
body: '$DEFAULT_CONTENT',
mimeType: 'text/html'
);
}
}
Note: I have attached the console log picture where i would like the result like this in green highlight at the beginning
Seems a pretty simple way to do it would be using ansiColor plugin with echo command.
pipeline{
agent any
stages {
stage('Example') {
steps {
ansiColor('xterm') {
echo "\u001B[1m\u001B[32mThis is for Datamax-Crawler\u001B[0m"
}
}
}
}
}