From 9bf5b2ea8e70926788b6e2b814e923455245c939 Mon Sep 17 00:00:00 2001 From: Ryan Faircloth <35384120+rfaircloth-splunk@users.noreply.github.com> Date: Fri, 10 Jul 2020 16:43:22 -0400 Subject: [PATCH] [fix] Ensure white space padding in the url is removed (#563) --- package/etc/go_templates/splunk_hec.t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/etc/go_templates/splunk_hec.t b/package/etc/go_templates/splunk_hec.t index 1bef15b..fddbea2 100644 --- a/package/etc/go_templates/splunk_hec.t +++ b/package/etc/go_templates/splunk_hec.t @@ -1,6 +1,6 @@ {{ define "SPLUNK_HEC" }} destination d_hec{{ .var_id }} { - {{- $url := (getenv (print "SPLUNK_HEC" .var_id "_URL")) }} + {{- $url := (getenv (print "SPLUNK_HEC" .var_id "_URL") | strings.Trim " " ) }} http( url("{{- $url | strings.ReplaceAll "/services/collector" "" | strings.ReplaceAll "/event" "" | regexp.ReplaceLiteral "[, ]+" "/services/collector/event " }}/services/collector/event") method("POST") @@ -13,7 +13,7 @@ destination d_hec{{ .var_id }} { user_agent("sc4s/1.0 (events)") user("sc4s") headers("{{- getenv (print "SC4S_DEST_SPLUNK_HEC" .var_id "_HEADERS") "Connection: close"}}") - password("{{- getenv (print "SPLUNK_HEC" .var_id "_TOKEN")}}") + password("{{- getenv (print "SPLUNK_HEC" .var_id "_TOKEN") | strings.Trim " " }}") persist-name("splunk_hec{{ .var_id }}") response-action(400 => drop, 404 => retry)