From 2882afebd6aa4c15e246a958b1c6a572175279ef Mon Sep 17 00:00:00 2001 From: rfaircloth-splunk Date: Sun, 14 Jun 2020 11:56:24 -0400 Subject: [PATCH] Update entrypoint.sh --- package/sbin/entrypoint.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/sbin/entrypoint.sh b/package/sbin/entrypoint.sh index 5abcde2..bb7f5a3 100755 --- a/package/sbin/entrypoint.sh +++ b/package/sbin/entrypoint.sh @@ -46,13 +46,13 @@ mkdir -p /opt/syslog-ng/var/log #Test HEC Connectivity HEC=$(echo '{{- getenv "SPLUNK_HEC_URL" | strings.ReplaceAll "/services/collector" "" | strings.ReplaceAll "/event" "" | regexp.ReplaceLiteral "[, ]+" "/services/collector/event " }}/services/collector/event' | gomplate | cut -d' ' -f 1) -INDEX=$(cat /opt/syslog-ng/etc/conf.d/local/config/splunk_index.csv | grep sc4s_events | cut -d, -f 3) -if ! curl -k "${HEC}" -H "Authorization: Splunk ${SPLUNK_HEC_TOKEN}" -d '{"event": "HEC TEST EVENT", "sourcetype": "SC4S:PROBE", "index":"${index}"}' +index=$(cat /opt/syslog-ng/etc/conf.d/local/context/splunk_index.csv | grep sc4s_events | cut -d, -f 3) +if ! curl -k "${HEC}?/index=${index}" -H "Authorization: Splunk ${SPLUNK_HEC_TOKEN}" -d '{"event": "HEC TEST EVENT", "sourcetype": "SC4S:PROBE"}' then echo SC4S_ENV_CHECK_HEC: Splunk unreachable startup will continue to prevent data loss if this is a transient failure else - echo SC4S_ENV_CHECK_HEC: Splunk connection succesfull - + echo SC4S_ENV_CHECK_INDEX: Splunk connection succesfull checking indexes + cat /opt/syslog-ng/etc/conf.d/local/context/splunk_index.csv | grep -v sc4s_metrics | cut -d, -f 3 | sort -u | while read index ; do export index; echo -e "\nSC4S_ENV_CHECK_INDEX: Checking $index" $(curl -s -S -k "${HEC}?index=${index}" -H "Authorization: Splunk ${SPLUNK_HEC_TOKEN}" -d '{"event": "HEC TEST EVENT", "sourcetype": "SC4S:PROBE"}') ; done fi #Setup SNMPD