You're unable to read via this Friend Link since it's expired. Learn more
Member-only story
How To Use Structured JSON Logging in Golang Applications
Structured logs are important for software debugging. Gladly, it is super easy to implement in Golang
Sick and tired of going through unstructured logs to track down a bug? Ever tried forcing a team of developers to write down their error messages in a structured way? Well, you’ve come to the right place in your journey to stop bad software logs.
What Is Structured Logging?
Logging is a very important part of software. We do need logs to keep track of what’s going on in systems and as they grow large it becomes increasingly important.
There are many great tools out there that help us parse logs. I’m personally a great fan of ElasticSearch for instance. But these tools are most of the time depending on a structured log, not a plain text blob mass that may or may not be written in a certain format.
I remember when being assigned a bug to track down, the system had about 30 CRON jobs running some scripts, and all the scripts wrote their output to a single file which was rotated by date. So there was at least some kind of central logging (not the most recommended one, but hey). There were logs for this ancient system, so I went in, duct tape in hand; I was going to…