Grafana query to filter on empty valued label
Asked Answered
L

0

6

Is there a way to specify filtering on Grafana query to include only results which have a specific label empty? Or at least have the only results with the label specified, even if it has an empty value?

My query looks like this. I want to list logs where I have traceId empty. Which unfortunately includes all logs where I do not have a traceId label.

{container="myproject-subfunction"}
|json|__error__ = ""
|traceId = ""

I want to distinguish between these two rows. And my current query includes both of them.

  • Without the label {"level":"info","message":"Some message 1"}
  • With the label empty {"level":"info","message":"Some message 2","traceId":""}

ps: This is about verifying a bugfix, where our code incorrectly logged empty fields.

Lambrecht answered 28/7, 2022 at 9:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.