I'm setting up my logging system using OpenTelemetry Collector in conjunction with Grafana and I want to send my application's logs to Loki for our developers to access. The challenge is that my logs are mixed – I have some in JSON and others in logfmt from Python and Go applications. I successfully configured logging in JSON format, which seems to be the easiest route, but I'm stuck on how to support logfmt. Is there a straightforward solution for that? Should I invest time in making logfmt work, or would it be better to just stick with JSON format for everything? I'm new to all of this logging stuff and would really appreciate your advice! Thanks!
2 Answers
You're on the right track! Keep your JSON logging simple with just a message and some structured metadata. If logfmt is already being used in production, it’s okay to keep it for a bit. But if you’re starting fresh, go with JSON. It simplifies everything – from collectors to dashboards, and makes maintenance easier in the long run.
Honestly, I recommend sticking to JSON. It's more consistent and easier to handle. If you're looking for a log collector that can also transform logfmt to JSON, you might want to check out Vector.

That sounds solid! I think I'll focus on JSON only where I can. Thanks for the advice!