How can I handle searching for unique IDs in loki

Hi all. Does anyone know the best approach for handling unique value searching in loki? In this particular case we have a unique error ID being generated (an 8 character GUID suffix) by our application which is relayed to the end user or test engineer. If the user raises a support case with the error ID, we can then correlate this via the logging system to a concrete error. However we can’t store this in a label because it is theoretically unbounded. Any tips, advice appreciated.

Can you just … search for it? LogQL supports filtering and searching on structured stuff that isn’t labels just fine. See https://grafana.com/docs/loki/latest/logql, you could do something like {job="whatever"} |= "deadbeef" or ``{job=“whatever”} | error_code="deadbeef"to search for an error codedeadbeef`, no?

1 Like