Golang client for Loki

I spent some time yesterday trying to use the loki repo as a go client for an internal command line tool to query logs. My understanding after using it, is that it’s not really designed for this purpose and and is only there to support the projects binaries. This seems to be confirmed by Grafana not using it to query logs either.

Is there a recommended way of interfacing with Loki using go. The JSON model returned from the api feels a little cumbersome to work with directly when tailing, also with the need to manage websockets.

Would there be any interest in a simpler text based response type for GET /loki/api/v1/tail, JSON seems to add a lot of overhead for something that seems like it could be <timestamp> <labels> <message> separated by newlines. Another alternative could be ndjson, which would make it trivial to parse a log stream

Is this the best place for this or should I open a feature request on github

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