You've already forked sap-jenkins-library
mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-11-06 09:09:19 +02:00
Splunk: Initialize Splunk client if dsn or prodCriblEndpoint provided (#4653)
* Initialize Splunk client if dsn or prodCriblEndpoint provided * Fix tests * Apply suggestions from code review * go generate --------- Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
68d034992f
commit
59c2f75ce1
@@ -144,7 +144,7 @@ func {{.CobraCmdFuncName}}() *cobra.Command {
|
||||
log.RegisterHook(&sentryHook)
|
||||
}
|
||||
|
||||
if len({{if .ExportPrefix}}{{ .ExportPrefix }}.{{end}}GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 {
|
||||
if len({{if .ExportPrefix}}{{ .ExportPrefix }}.{{end}}GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 || len({{if .ExportPrefix}}{{ .ExportPrefix }}.{{end}}GeneralConfig.HookConfig.SplunkConfig.ProdCriblEndpoint) > 0 {
|
||||
splunkClient = &splunk.Splunk{}
|
||||
logCollector = &log.CollectorHook{CorrelationID: {{if .ExportPrefix}}{{ .ExportPrefix }}.{{end}}GeneralConfig.CorrelationID}
|
||||
log.RegisterHook(logCollector)
|
||||
|
||||
@@ -181,7 +181,7 @@ func TestStepCommand() *cobra.Command {
|
||||
log.RegisterHook(&sentryHook)
|
||||
}
|
||||
|
||||
if len(piperOsCmd.GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 {
|
||||
if len(piperOsCmd.GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 || len(piperOsCmd.GeneralConfig.HookConfig.SplunkConfig.ProdCriblEndpoint) > 0 {
|
||||
splunkClient = &splunk.Splunk{}
|
||||
logCollector = &log.CollectorHook{CorrelationID: piperOsCmd.GeneralConfig.CorrelationID}
|
||||
log.RegisterHook(logCollector)
|
||||
|
||||
@@ -180,7 +180,7 @@ func TestStepCommand() *cobra.Command {
|
||||
log.RegisterHook(&sentryHook)
|
||||
}
|
||||
|
||||
if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 {
|
||||
if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 || len(GeneralConfig.HookConfig.SplunkConfig.ProdCriblEndpoint) > 0 {
|
||||
splunkClient = &splunk.Splunk{}
|
||||
logCollector = &log.CollectorHook{CorrelationID: GeneralConfig.CorrelationID}
|
||||
log.RegisterHook(logCollector)
|
||||
|
||||
Reference in New Issue
Block a user