Improving the experience of browsing Renovate debug logs

Featured image for sharing metadata for article

Renovate's debug logs

I spend a lot of my time working through Renovate's debug logs.

This may be through Running Renovate in a number of places, such as at work (Elastic), or during my work on dependency-management-data, of which the best data can be collected through renovate-graph, a wrapper on top of Renovate.

Sometimes it's a case of trying to dry run a change locally or it may be helping an internal customer debug why a PR isn't getting raised, and often requires delving into the debug logs.

Renovate's debug logs are really great, and like many tools, once you've gotten used to reading them and understanding the flow of the tool, you can reason about how Renovate's running very consistently.

The debug logs are outputted in the JSON Lines format, which means you'll have lines like the following:

{"name":"renovate","hostname":"TheColonel","pid":92906,"level":20,"logContext":"MuGSC6XgB19laFx8mGN5C","config":{},"msg":"File config","time":"2024-02-21T18:37:08.087Z","v":0}
// ...
{"name":"renovate","hostname":"TheColonel","pid":92906,"level":20,"logContext":"MuGSC6XgB19laFx8mGN5C","repository":"jamietanna/jamietanna","baseBranch":"main","config":{"github-actions":[{"deps":[{"depName":"actions/setup-go","commitMessageTopic":"{{{depName}}} action","datasource":"github-tags","versioning":"docker","depType":"action","replaceString":"actions/setup-go@v2","autoReplaceStringTemplate":"{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # {{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}","currentValue":"v2","updates":[{"bucket":"major","newVersion":"v5","newValue":"v5","releaseTimestamp":"2023-12-05T16:50:42.000Z","newMajor":5,"newMinor":null,"updateType":"major","branchName":"renovate/actions-setup-go-5.x"}],"packageName":"actions/setup-go","warnings":[],"sourceUrl":"https://github.com/actions/setup-go","registryUrl":"https://github.com","currentVersion":"v2","isSingleVersion":true,"fixedVersion":"v2"},{"depName":"actions/checkout","commitMessageTopic":"{{{depName}}} action","datasource":"github-tags","versioning":"docker","depType":"action","replaceString":"actions/checkout@v2","autoReplaceStringTemplate":"{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # {{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}","currentValue":"v2","updates":[{"bucket":"major","newVersion":"v4","newValue":"v4","releaseTimestamp":"2023-10-17T15:52:30.000Z","newMajor":4,"newMinor":null,"updateType":"major","branchName":"renovate/actions-checkout-4.x"}],"packageName":"actions/checkout","warnings":[],"sourceUrl":"https://github.com/actions/checkout","registryUrl":"https://github.com","currentVersion":"v2","isSingleVersion":true,"fixedVersion":"v2"},{"depName":"ubuntu","currentValue":"latest","replaceString":"ubuntu-latest","depType":"github-runner","datasource":"github-runners","autoReplaceStringTemplate":"{{depName}}-{{newValue}}","skipReason":"invalid-version","updates":[],"packageName":"ubuntu"}],"packageFile":".github/workflows/rebuild.yml"}]},"msg":"packageFiles with updates","time":"2024-02-21T18:37:12.009Z","v":0}
// ...
{"name":"renovate","hostname":"TheColonel","pid":92906,"level":20,"logContext":"MuGSC6XgB19laFx8mGN5C","repository":"deepmap/oapi-codegen","msg":"32 flattened updates found: actions/checkout, actions/setup-go, actions/checkout, actions/setup-go, actions/checkout, actions/setup-go, actions/checkout, actions/setup-go, github.com/deepmap/oapi-codegen/v2, github.com/getkin/kin-openapi, github.com/go-chi/chi/v5, github.com/gofiber/fiber/v2, github.com/gorilla/mux, github.com/kataras/iris/v12, github.com/labstack/echo/v4, github.com/lestrrat-go/jwx, github.com/oapi-codegen/runtime, github.com/oapi-codegen/testutil, github.com/getkin/kin-openapi, golang.org/x/tools, gopkg.in/yaml.v2, github.com/deepmap/oapi-codegen/v2, github.com/getkin/kin-openapi, github.com/go-chi/chi/v5, github.com/gofiber/fiber/v2, github.com/gorilla/mux, github.com/kataras/iris/v12, github.com/labstack/echo/v4, github.com/oapi-codegen/nullable, github.com/oapi-codegen/runtime, github.com/oapi-codegen/testutil, gopkg.in/yaml.v2","time":"2024-02-21T18:37:16.685Z","v":0}

So how do you go about trying to read these more human-ly?

When I'm dry running locally, I'll start by reaching for a tool I've written, jjj, which converts a JSON Lines format to an array of JSON objects, each of which are pretty-printed.

From there, I'll read through them with Neovim, with JSON syntax highlighting on, and that seems to work for me.

Naturally at work, we have our Renovate logs ingested into the Elastic Stack, so that'll be my "first port of call" to check in on the logs, and do some additional filtering I may need to find what I'm looking for.

But one thing that I do find slightly annoying with our logs at work is that they include information about things like the Kubernetes cluster Renovate is running on, as well as other information that isn't relevant in this case where I'm trying to debug what's going on.

So if I'm finding it hard to filter down what I'm looking for, and get the raw metadata that's interesting, I'll end up grabbing a copy of the debug logs for local usage.

Vibe coding πŸ€–βœ¨

On Friday afternoon - after a busy, productive week - I wanted something low-energy to round out the week, and thought that trying to semi-vibe-code something may be a fun way of learning some more about LLMs, as well as getting something productive done.

I'd been looking around for some good Neovim plugins and found olimorris/codecompanion.nvim, and this was in particular a strong contender for getting a chance to see how I could more heavily embed LLMs into my workflow.

So I ended up thinking - what could I do to make it easier to read through these logs?

One thing I've very much liked for some time is the way that Mend, the company behind Renovate, has designed the log interface on the Mend Renovate Community Cloud:

For instance:

A screenshot of the job log output from one of the porjects Jamie maintains (oapi-codegen) which is onboarded to Mend Renovate Community Cloud. In it, there are a number of DEBUG logs and one INFO log. The DEBUG logs are given a nice blue colour, and the INFO a nice green. The logs all have a log message associated with them, and for the INFO log, there is a grey output which shows a JSON object for some additional context on the log message. It's a nice visual display for important information (log level and log message) with any additional context, but less prominently shown

I like the way this is presented, and wondered if maybe I could go about building a command-line tool to do effectively the same, with some help from some LLMs πŸ€–?

What did I build?

I set about building a CLI tool that would take in a log file, and output each line in a similar means to how Mend Renovate Community Cloud does it.

However, as I started working on it, I realised that maybe a standalone tool that spat out the logs to the terminal may not be as useful when there are hundreds of lines of logs.

As well as the CLI, I set about building a Terminal User Interface (TUI) which would provide more interactive log viewing.

You can find the final result on GitLab.

Terminal User Interface

There's a lot more scope for what I want the TUI to be able to do, but as a starting point, it can take a log file, output the log lines, and if there's any additional context, allow you to toggle display using the Enter key.

You can see this in action here:

Notice that when a log line's extra content is expanded, we can scroll in that, too.

CLI

This was the first iteration, and it works quite well too, albeit not as helpful when there are lots of logs.

I've left it in the repository, but I'm unlikely to invest as much time in it compared to the TUI, which I feel will have much more value.

You can see this in action here:

(notice that all the output speeds past!)

Happy?

It's taken a bit longer than I'd hoped - partly because of the human involved in the loop - but I am.

As I started prototyping it, I already found it very useful, and a better way of visualising what's going on - and it even helped me find some interesting things in the debug logs I'd not seen before πŸ˜…

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#blogumentation #renovate #go #ai.

πŸ€– Content in this blog post (prose or code snippets) includes code derived from the following LLMs:

  • claude:3.7-sonnet
  • claude:3.7-sonnet-thinking
  • gpt:4o
  • gpt:4.1

This post was filed under articles.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.