Description
For many logging scenarios it's useful to lookup/query the log data on high cardinality labels such as request-ids, user-ids, ip-addresses, request-url and so on.
While I realize that high cardinality will affect indices, I think it's worth discussing whether this is something that Loki can support in the future.
There are a lot of logging use-cases where people can easily ditch full-text search that ELK and others provide. But not having easy lookup on log metadata, such as user-id or request-id, is a problem.
I should note that this doesn't necessarily need to be "make labels high cardinality", it could also be the introduction of some type of log-line metadata or properties, that are allowed to be high cardinality and can be queried for.
Example
Our services (nginx, application servers, etc) emit JSON lines[1] like this:
{ "timestamp" : "2018-12-24T18:00:00", "user-id" : "abc", "request-id" : "123", "message" : "Parsing new user data" }
{ "timestamp" : "2018-12-24T18:01:00", "user-id: " "def", "request-id" : "456", "message" : "Updating user record" }
{ "timestamp" : "2018-12-24T18:02:00", "user-id: " "abc", "request-id" : "789", "message" : "Keep alive ping from client" }
We ingest these into our log storage (which we would like to replace with Loki), and here are some common types of tasks that we currently do:
-
Bring up logs for a particular user. Usually to troubleshoot some bug they are experiencing. Mostly we know the rough timeframe (for example that it occurred during the past 2 weeks). Such a filter will usually bring up 5-200 entries. If there are more than a few entries we'll usually filter a bit more, on a stricter time intervall or based on other properties (type of request, etc).
-
Find the logs for a particular request, based on its request id. Again, we'd usually know the rough timeframe, say +/- a few days.
-
Looking at all requests that hit a particular endpoint, basically filtering on 2-3 log entry properties.
All of these, which I guess are fairly common for a logging system, require high cardinality labels (or some type of metadata/properties that are high cardinality and can be queried).
Updates
A few updates, since this issue was originally opened.
-
This design proposal doesn't directly address high-cardinality labels, but solves some of the underlying problems.
With LogQL you can grep over large amounts of data fairly easily, and find those needles. It assumes that the queries can run fast enough on large log corpora.
-
There is some discussion in this thread, on making it easier to find unique IDs, such as trace-id and request-id