mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/vmagent/remotewrite: do not show -remoteWrite.url
in logs if -remoteWrite.showURL
isn't set
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/773
This commit is contained in:
parent
f7636b0342
commit
127537d631
3 changed files with 9 additions and 5 deletions
|
@ -61,6 +61,7 @@ func main() {
|
|||
flag.CommandLine.SetOutput(os.Stdout)
|
||||
flag.Usage = usage
|
||||
envflag.Parse()
|
||||
remotewrite.InitSecretFlags()
|
||||
buildinfo.Init()
|
||||
logger.Init()
|
||||
cgroup.UpdateGOMAXPROCSToCPUQuota()
|
||||
|
|
|
@ -45,6 +45,14 @@ var allRelabelConfigs atomic.Value
|
|||
// since it may lead to high memory usage due to big number of buffers.
|
||||
var maxQueues = runtime.GOMAXPROCS(-1) * 4
|
||||
|
||||
// InitSecretFlags must be called after flag.Parse and before any logging.
|
||||
func InitSecretFlags() {
|
||||
if !*showRemoteWriteURL {
|
||||
// remoteWrite.url can contain authentication codes, so hide it at `/metrics` output.
|
||||
flagutil.RegisterSecretFlag("remoteWrite.url")
|
||||
}
|
||||
}
|
||||
|
||||
// Init initializes remotewrite.
|
||||
//
|
||||
// It must be called after flag.Parse().
|
||||
|
@ -60,10 +68,6 @@ func Init() {
|
|||
if *queues <= 0 {
|
||||
*queues = 1
|
||||
}
|
||||
if !*showRemoteWriteURL {
|
||||
// remoteWrite.url can contain authentication codes, so hide it at `/metrics` output.
|
||||
flagutil.RegisterSecretFlag("remoteWrite.url")
|
||||
}
|
||||
initLabelsGlobal()
|
||||
rcs, err := loadRelabelConfigs()
|
||||
if err != nil {
|
||||
|
|
|
@ -15,7 +15,6 @@ func logAllFlags() {
|
|||
lname := strings.ToLower(f.Name)
|
||||
value := f.Value.String()
|
||||
if flagutil.IsSecretFlag(lname) {
|
||||
// Do not expose passwords and keys to prometheus.
|
||||
value = "secret"
|
||||
}
|
||||
Infof("flag %q = %q", f.Name, value)
|
||||
|
|
Loading…
Reference in a new issue