From d42b99ea59c530a3a8337ad12fc1b45a8997172c Mon Sep 17 00:00:00 2001
From: Florian Sesser <florian@private.storage>
Date: Fri, 11 Feb 2022 07:17:31 +0000
Subject: [PATCH] Add comment about journal internal labels

---
 nixos/modules/monitoring/exporters/promtail.nix | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/nixos/modules/monitoring/exporters/promtail.nix b/nixos/modules/monitoring/exporters/promtail.nix
index c056ebeb..e279b481 100644
--- a/nixos/modules/monitoring/exporters/promtail.nix
+++ b/nixos/modules/monitoring/exporters/promtail.nix
@@ -39,6 +39,10 @@ in {
             host = hostName;
           };
         };
+        # The journal has many internal labels, that by default will
+        # be dropped because of their "__" prefix.  To keep them, rename them.
+        # https://grafana.com/docs/loki/latest/clients/promtail/scraping/#journal-scraping-linux-only
+        # https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html
         relabel_configs = [{
           source_labels = [ "__journal__systemd_unit" ];
           target_label = "unit";
-- 
GitLab