From 0331a55b3eb03b3dfa1243bf79032c55a619f51b Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Mon, 15 Sep 2025 07:53:13 -0500 Subject: [PATCH] r/fluent-bit: Set HOSTNAME environment variable Fluent-bit does not have any native capability for setting a field with the hostname of the machine, but it can set a field with the value of an environment variable. Thus, we can set the `HOSTNAME` environment variable and then use that to set the field in the pipeline. --- roles/fluent-bit/files/fluent-bit.service | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/fluent-bit/files/fluent-bit.service b/roles/fluent-bit/files/fluent-bit.service index c2b1b6f..6bbc134 100644 --- a/roles/fluent-bit/files/fluent-bit.service +++ b/roles/fluent-bit/files/fluent-bit.service @@ -10,6 +10,7 @@ StartLimitBurst=5 Type=exec ExecStart=/usr/bin/fluent-bit -c /etc/fluent-bit/fluent-bit.yml -Y ExecReload=/bin/kill -HUP $MAINPID +Environment=HOSTNAME=%H StateDirectory=fluent-bit Restart=always RestartSec=1