From c43c02393061079985054c3fa6613787c8fff767 Mon Sep 17 00:00:00 2001 From: Eric Chlebek Date: Wed, 14 Aug 2024 13:13:31 -0700 Subject: [PATCH] Add wrapper script for otelcol-sumo This commit adds a script that calls `exec otelcol-sumo` with either the --config or --remote-config flags, based on the presence of /etc/otelcol-sumo/sumologic-remote.yaml. Using exec replaces the shell with otelcol-sumo, so it doesn't appear in the process list as the shell script. This allows us to correctly invoke otelcol-sumo from systemd and launchd. Signed-off-by: Eric Chlebek --- assets/otelcol-sumo.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 assets/otelcol-sumo.sh diff --git a/assets/otelcol-sumo.sh b/assets/otelcol-sumo.sh new file mode 100755 index 00000000..5333e82f --- /dev/null +++ b/assets/otelcol-sumo.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ -f /etc/otelcol-sumo/sumologic-remote.yaml ]; then + exec /usr/local/bin/otelcol-sumo --remote-config opamp:/etc/otelcol-sumo/sumologic-remote.yaml +else + exec /usr/local/bin/otelcol-sumo --config /etc/otelcol-sumo/sumologic.yaml --config "glob:/etc/otelcol-sumo/conf.d/*.yaml" +fi