From efbbae16eac311dbfa67ba30b0fb83bc0a771e8a Mon Sep 17 00:00:00 2001 From: Raj Nishtala Date: Tue, 30 Jul 2024 18:03:20 -0400 Subject: [PATCH 1/2] fix(install): Fix script to always install the latest stable version --- install-script/install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/install-script/install.sh b/install-script/install.sh index fa18596b..927f2995 100755 --- a/install-script/install.sh +++ b/install-script/install.sh @@ -456,7 +456,9 @@ function get_latest_version() { # get latest version directly from website if there is no versions from api if [[ -z "${versions}" ]]; then - curl --retry 5 --connect-timeout 5 --max-time 30 --retry-delay 0 --retry-max-time 150 -s https://github.com/SumoLogic/sumologic-otel-collector/releases | grep -oE '/SumoLogic/sumologic-otel-collector/releases/tag/(.*)"' | head -n 1 | sed 's%/SumoLogic/sumologic-otel-collector/releases/tag/v\([^"]*\)".*%\1%g' + curl --retry 5 --connect-timeout 5 --max-time 30 --retry-delay 5 --retry-max-time 150 -s https://github.com/SumoLogic/sumologic-otel-collector/releases \ + | grep -Eo '/SumoLogic/sumologic-otel-collector/releases/tag/v[0-9]+\.[0-9]+\.[0-9]+-sumo-[0-9]+[^-]' \ + | head -n 1 | sed 's%/SumoLogic/sumologic-otel-collector/releases/tag/v\([^"]*\)".*%\1%g' else # sed 's/ /\n/g' converts spaces to new lines echo "${versions}" | sed 's/ /\n/g' | head -n 1 @@ -489,7 +491,7 @@ function get_versions() { } function get_package_versions() { - # returns empty in case we exceeded github rate limit + # returns empty in case we exceeded github rate limit. This can happen if we are running this script too many times in a short period. if [[ "$(github_rate_limit)" == "0" ]]; then return fi From c43c02393061079985054c3fa6613787c8fff767 Mon Sep 17 00:00:00 2001 From: Eric Chlebek Date: Wed, 14 Aug 2024 13:13:31 -0700 Subject: [PATCH 2/2] 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