From 380b7e1f5ec9fb7fe75b699bf8dd8549fc513db2 Mon Sep 17 00:00:00 2001
From: Florian Sesser <florian@private.storage>
Date: Thu, 3 Feb 2022 13:26:28 +0000
Subject: [PATCH] Promtail: Add host label

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

diff --git a/nixos/modules/monitoring/exporters/promtail.nix b/nixos/modules/monitoring/exporters/promtail.nix
index b068d9ee..6668f180 100644
--- a/nixos/modules/monitoring/exporters/promtail.nix
+++ b/nixos/modules/monitoring/exporters/promtail.nix
@@ -6,7 +6,12 @@
 #              exporters, but it is very similar in what it is doing -
 #              preparing local data and sending it off to a TSDB.
 
-{
+{ config, ... }:
+
+let
+  hostName = config.networking.hostName;
+
+in {
   config.services.promtail.enable = true;
   config.networking.firewall.interfaces.monitoringvpn.allowedTCPPorts = [ 9080 ];
   config.services.promtail.configuration = {
@@ -25,6 +30,7 @@
       journal = {
         labels = {
           job = "systemd-journal";
+          host = hostName;
         };
       };
       relabel_configs = [{
-- 
GitLab