Files
configpolicy/roles/fluent-bit/files/fluent-bit.service
Dustin C. Hatch 0331a55b3e 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.
2025-09-15 07:53:13 -05:00

38 lines
837 B
Desktop File

[Unit]
Description=Fluent Bit
Documentation=https://docs.fluentbit.io/manual/
Requires=network.target
After=network.target
StartLimitIntervalSec=5
StartLimitBurst=5
[Service]
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
BindPaths=%S/fluent-bit
CapabilityBoundingSet=CAP_DAC_READ_SEARCH
LockPersonality=yes
MemoryDenyWriteExecute=yes
PrivateDevices=yes
PrivateTmp=yes
ProtectControlGroups=yes
ProtectHome=yes
ProtectHostname=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
ProtectSystem=strict
ReadOnlyPaths=/var/log
ReadWritePaths=%S/fluent-bit
RestrictNamespaces=yes
RestrictRealtime=yes
SystemCallArchitectures=native
TemporaryFileSystem=%S:ro
[Install]
WantedBy=multi-user.target