Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions pkg/plugin/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func NewPlugin(informer cache.SharedIndexInformer, cfg *config.Config, logger lo
metrics.Clients.WithLabelValues(client.Seed.String()).Inc()

logger.Info("logging plugin created",
"seed_client_url", l.seedClient.GetEndPoint(),
"seed_client_url", redactCredentialsFromEndpoint(l.seedClient.GetEndPoint()),
"seed_queue_name", cfg.OTLPConfig.DQueConfig.DQueName,
)

Expand Down Expand Up @@ -165,8 +165,9 @@ func (l *logging) Close() {
if l.controller != nil {
l.controller.Stop()
}

l.logger.Info("logging plugin stopped",
"seed_client_url", l.seedClient.GetEndPoint(),
"seed_client_url", redactCredentialsFromEndpoint(l.seedClient.GetEndPoint()),
"seed_queue_name", l.cfg.OTLPConfig.DQueConfig.DQueName,
)
}
Expand All @@ -188,3 +189,10 @@ func (l *logging) isDynamicHost(dynamicHostName string) bool {
l.dynamicHostRegexp != nil &&
l.dynamicHostRegexp.MatchString(dynamicHostName)
}

// Helper function to redact possible `user:password` credentials from configured endpoint before logging
func redactCredentialsFromEndpoint(endpoint string) string {
r := regexp.MustCompile(`//.*@`)

return r.ReplaceAllString(endpoint, "//xxxxx@")
}
Loading