mirror of
https://github.com/wahyd4/telegraf.git
synced 2026-08-09 04:36:05 +10:00
Ensure user is stripped out of logs in influx input
The returned error may contain sensitive information if older versions of go are used to build. (1.12+ are ok)
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -72,10 +73,16 @@ func (i *InfluxDB) Gather(acc telegraf.Accumulator) error {
|
||||
var wg sync.WaitGroup
|
||||
for _, u := range i.URLs {
|
||||
wg.Add(1)
|
||||
go func(url string) {
|
||||
go func(u string) {
|
||||
defer wg.Done()
|
||||
if err := i.gatherURL(acc, url); err != nil {
|
||||
acc.AddError(fmt.Errorf("[url=%s]: %s", url, err))
|
||||
if err := i.gatherURL(acc, u); err != nil {
|
||||
yourl, err2 := url.Parse(u)
|
||||
if err2 != nil || yourl == nil {
|
||||
acc.AddError(err)
|
||||
} else {
|
||||
yourl.User = nil
|
||||
acc.AddError(fmt.Errorf("[url=%s]: %s", yourl.String(), err.Error()))
|
||||
}
|
||||
}
|
||||
}(u)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user