diff --git a/cmd/nginx-ingress/main.go b/cmd/nginx-ingress/main.go index d911d2f818..f646199045 100644 --- a/cmd/nginx-ingress/main.go +++ b/cmd/nginx-ingress/main.go @@ -736,7 +736,14 @@ func createPlusAndLatencyCollectors( streamServerZoneVariableLabels := []string{"resource_type", "resource_name", "resource_namespace"} variableLabelNames := nginxCollector.NewVariableLabelNames(upstreamServerVariableLabels, serverZoneVariableLabels, upstreamServerPeerVariableLabelNames, streamUpstreamServerVariableLabels, streamServerZoneVariableLabels, streamUpstreamServerPeerVariableLabelNames, nil, nil) - promlogConfig := &promlog.Config{} + infoLevel := new(promlog.AllowedLevel) + err := infoLevel.Set("info") + if err != nil { + glog.Error("Error setting prometheus exporter log level") + } + promlogConfig := &promlog.Config{ + Level: infoLevel, + } logger := promlog.New(promlogConfig) plusCollector = nginxCollector.NewNginxPlusCollector(plusClient, "nginx_ingress_nginxplus", variableLabelNames, constLabels, logger) go metrics.RunPrometheusListenerForNginxPlus(*prometheusMetricsListenPort, plusCollector, registry, prometheusSecret) diff --git a/internal/metrics/listener.go b/internal/metrics/listener.go index 4f247eca1e..65e3e2b4e4 100644 --- a/internal/metrics/listener.go +++ b/internal/metrics/listener.go @@ -26,7 +26,15 @@ func NewNginxMetricsClient(httpClient *http.Client) *prometheusClient.NginxClien // RunPrometheusListenerForNginx runs an http server to expose Prometheus metrics for NGINX func RunPrometheusListenerForNginx(port int, client *prometheusClient.NginxClient, registry *prometheus.Registry, constLabels map[string]string, prometheusSecret *v1.Secret) { - promlogConfig := &promlog.Config{} + infoLevel := new(promlog.AllowedLevel) + err := infoLevel.Set("info") + if err != nil { + glog.Error("Error setting prometheus exporter log level") + } + promlogConfig := &promlog.Config{ + Level: infoLevel, + } + logger := promlog.New(promlogConfig) registry.MustRegister(nginxCollector.NewNginxCollector(client, "nginx_ingress_nginx", constLabels, logger)) runServer(strconv.Itoa(port), registry, prometheusSecret)