3

We started to migrate our simple jobs to pipeline and i would like to make some logging from that. Mainly diagnostic logging about the durations,usage and outputs of our custom stages.

So my question is: Is there a simple way to integrate our pipeline jobs with any log analyzer tool like logstash? With a plugin that is compatible with pipeline?

So the flow will be something like:

  • Make some tricky logging in the groovy script(log info ..message..)
  • After or during the build we send them to the "tool"
  • We can make some query or see the result on graphs.

Other way is to send the full build log to a tool and then after some process we reach our goal.

Thanks for the help :)

Alessio
  • 3,404
  • 19
  • 35
  • 48
hEngi
  • 865
  • 10
  • 23
  • you can use these APIs to fetch job status, test results and many more http://stackoverflow.com/a/25685928/3201354 – Jignesh Feb 06 '17 at 16:07
  • Thanks for your answer! I'm looking for a certain tool that can integrate with jenkins. Throught some plugin maybe. Writing my own solution with restcalls looks a bit overhead now. But its still an option :) – hEngi Feb 07 '17 at 08:39

1 Answers1

3

So our solution was this:

  • Add Log4j for logging Use Grape for dependency management You have to solve the serialization problem(NonCPS or other way)
  • Used the log4j 2 gelf appender It is a predefined appender for log4j 2. More details here You can feed your logs messages to graylog with this.
  • Graylog2 to create dashboards There is more details here

Other alternatives: - Datadog - ELK stack

hEngi
  • 865
  • 10
  • 23
  • were you able to add log4j to your jenkins pipeline? I haven't been able to do that. I don't see my logs on jenkins console output – uptoNoGood Mar 03 '20 at 09:32