From 5ae3e7efeed483d86f5432fac201a4f964158496 Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Thu, 30 Nov 2023 10:33:14 +0100 Subject: [PATCH] [v10.0.x] Docs: adds docs on excluding labels (#78887) Docs: adds docs on excluding labels (#78806) * Docs: adds docs on excluding labels * run prettier * Update docs/sources/alerting/fundamentals/annotation-label/labels-and-label-matchers.md Co-authored-by: Gilles De Mey * adds table for display * ran prettier --------- Co-authored-by: Gilles De Mey (cherry picked from commit 1b2a621533161fcc8014f984039aa1aae59c7ff0) Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> --- .../annotation-label/labels-and-label-matchers.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/sources/alerting/fundamentals/annotation-label/labels-and-label-matchers.md b/docs/sources/alerting/fundamentals/annotation-label/labels-and-label-matchers.md index 09c14d36661..e16b71e020c 100644 --- a/docs/sources/alerting/fundamentals/annotation-label/labels-and-label-matchers.md +++ b/docs/sources/alerting/fundamentals/annotation-label/labels-and-label-matchers.md @@ -50,3 +50,15 @@ then: - A label matcher defined as `id=~[0-9]+` matches this alert rule. - A label matcher defined as `baz!~[0-9]+` matches this alert rule. - Two label matchers defined as `foo=bar` and `id=~[0-9]+` match this alert rule. + +## Exclude labels + +You can also write label matchers to exclude labels. + +Here is an example that shows how to exclude the label `Team`. You can choose between any of the values below to exclude labels. + +| Label | Operator | Value | +| ------ | -------- | ----- | +| `team` | `=` | `""` | +| `team` | `!~` | `.+` | +| `team` | `=~` | `^$` |