I have a Jenkins job with 100+ builds. I need to find all the assemblies of this work to find assemblies that have a specific line in the output to the console. Is there a plugin for this? How to do it?
I often use the Jenkins Script Console for such tasks. The Groovy plugin provides the Script console, but if you intend to use the Script console for periodic maintenance, I also want a Scriptler plugin that allows you to manage the scripts that you run.
From the Jenkins → Script management console, you can write groovy Script, which iterates through the assembly of tasks, looking for the corresponding line:
JOB_NAME = "My Job" BUILD_STRING = "Hello, world" def job = Jenkins.instance.items.find { it.name == JOB_NAME } for (build in job.builds) { def log = build.log if (log.contains(BUILD_STRING)) { println "${job.name}: ${build.id}" } }
If there are no additional requirements, I would do it simply in the shell, for example:
find $JENKINS_HOME/jobs/haystack -name log -exec grep -l needle {} \; \ | sed 's|.*/\(.*\)/log|\1|'
There is a Log Parser Plugin
highlighting lines of interest in the log (errors, warnings, information)splitting the log into sections showing a summary of the number of errors, warnings, and information lines in the log and its sections.linking a summary of errors and warnings in the context of the full log, which makes it easy to find the line you are interested inshows a summary of errors and warnings on the build page
highlighting lines of interest in the log (errors, warnings, information)
splitting the log into sections showing a summary of the number of errors, warnings, and information lines in the log and its sections.
linking a summary of errors and warnings in the context of the full log, which makes it easy to find the line you are interested in
shows a summary of errors and warnings on the build page
If these are old logs, then @jil has an answer suggesting that you are on Linux.
Thank you all for your valuable decisions. After a little extra research, I found that Jenkins has a plugin for this.
https://wiki.jenkins-ci.org/display/JENKINS/Lucene-Search
This saves the console output and users can search in the search box.