I searched a lot for a solution to analyze the log.
- use
rawBuild not normal because I want to execute my scripts in a sandbox without additional statements - using
tee in the steps that I want to analyze was not quite so, because I do not want to change the previous steps, and I do not want my entire log to be in RAM (and, unfortunately, I need this on a Windows machine)
I found a solution that Jesse Glakes answered:
- In my.jenkins.url / pipeline-syntax / globals you can see that
manager -variable allows you to parse the log using manager.logContains(regexp) or manager.getLogMatcher(regexp) - So, if you just want to verify that your log contains the string
myTestString , you can simply call manager.logContains('.*myTestString.*') - If you want to get some information from the first relevant line, you can use
manager.getLogMatcher(regexp)
Unfortunately, I did not find a way to getLogMatcher entire log ( getLogMatcher returns only the first matching Matcher string). Therefore, I currently see no way, for example, count how often the log file contains a special line.
Sergej Werfel
source share