Skip to content

Commit

Permalink
Update entrypoint.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
rfaircloth-splunk committed Jun 14, 2020
1 parent 300a704 commit 2882afe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions package/sbin/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2882afe

Please sign in to comment.