Unable to query Loki

I setup Loki (distributed w/ Cassandra) 2.2.0 (and 2.2.1) using the Helm chart, with promtail ingesting log data, and I get the error below when I try to query Loki:

curl -v -H "Content-Type: application/json" "http://<url>:3100/loki/api/v1/query" --data-urlencode 'query={namespace=<mynamespace}'

Syntax error: unexpected $end

The Grafana dashboard shows Loki is ingesting data into Cassandra but I can’t query and get data back. Any ideas?

I’m also getting these errors in the logs:

msg: “TCPTransport: unknown message type”
msgType: G

Hi @datadude

Your query {namespace=<mynamespace} is invalid - the query parser is expecting to find the end of the line because of a syntax error.

it’s actually ‘query={namespace=“mon”}’
I just put this “<>” to show its a variable.

This is a vanilla install of Loki. It’s a problem for 2.2.0 and 2.2.1.

/loki/api/v1/labels works but /loki/api/v1/query does not.

When I add a -G the response says ‘not implemented’

curl  -G -v -H "Content-Type: application/json" "http://<url>:3100/loki/api/v1/query" --data-urlencode 'query={namespace="mon"}'

I can’t be the only one having this problem with Loki Distributed and Cassandra. If I just tear down Cassandra and Loki and do a fresh install I get the same problem.

I’m still getting the response ‘not implemented’ when I query Loki /query. Oh well. Maybe the next version will resolve this.

I resolved my issue by setting two specific parameters. See info here:

1 Like