Jenkins Logstash plugin to show current state of all jobs in one Kibana graph

This question is regarding Jenkins, the use of their logstash plugin to send build logs to elasticsearch and how to get the current state of all jobs. For example, let's say there are 10 jobs. I'd like to generate a graph to show how many of those are currently failing/passing using the latest build number for each job (not sure if that's the best to look at). I can currently get the latest result for individual jobs using the top hit aggregation, but I'm trying to avoid having to create a unique graph for every job. Does anyone know how I can accomplish getting all jobs to show their current state (success/failure) in just one graph (7 jobs most recently passed and 3 failed)?

You could try something like this...

I created a Data Table visualization. My first metric is Max @timestamp
For the Bucket aggregation I used a Terms aggregation on extension.raw, but you would use the Jenkins job name I think.
And the I created another metric for Top Hit on agent.keyword, but here you would use the field that represents the status of Jenkins job.

I think this would show you the latest status of each job, but please verify with your data before you trust that I did this correctly.

Regards,
Lee

1 Like

That's exactly what I needed! Thank you for the help. I had been banging my head against the wall trying to do this with a pie chart. I still can't figure it out with that kind of chart, but the data table did the trick.

1 Like

I just came up with one other enhancement question. I haven't been able to figure it out so far, but is there then a way to let's say count up the number of jobs currently set to success and then count up the ones currently set to failure? I've tried adding counts, but it just seems to add up the total number for each build.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.