From d7c176dc5472103f7b67aba1169bc47f45c94fa2 Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Mon, 30 Jun 2025 13:12:55 +0200 Subject: [PATCH] Reduce SO log noise - introduce logging.request-status.exclusions property to allow disabling request logging for certain paths (i.e liveness probes) in catalog-db and request-db-adapter - disable logging for the scheduled performDnsLookup - disable logging for the scheduled checkAllClientsActive Issue-ID: SO-4192 Signed-off-by: Fiete Ostkamp Change-Id: I491aa4b6e9d4ec2ce02e3559026edfad9bfa229c --- .../java/org/onap/so/adapters/catalogdb/WebMvcConfig.java | 12 +++++++++--- .../src/main/resources/application.yaml | 4 ++++ .../so/adapters/requestsdb/application/WebMvcConfig.java | 12 +++++++++--- .../src/main/resources/application.yaml | 8 ++++++-- .../java/org/onap/so/db/connections/ScheduledDnsLookup.java | 1 - .../java/org/onap/so/utils/ExternalTaskServiceUtils.java | 1 - 6 files changed, 28 insertions(+), 10 deletions(-) diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java index cd3b2a377b..e464082ce3 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,6 +24,7 @@ package org.onap.so.adapters.catalogdb; import org.onap.logging.filter.spring.LoggingInterceptor; import org.onap.logging.filter.spring.StatusLoggingInterceptor; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -34,6 +35,9 @@ import org.springframework.web.servlet.handler.MappedInterceptor; @ComponentScan(basePackages = {"org.onap.logging.filter"}) public class WebMvcConfig extends WebMvcConfigurerAdapter { + @Value("${logging.request-status.exclusions:}") + private String[] excludedPaths = new String[0]; + @Autowired private LoggingInterceptor loggingInterceptor; @@ -47,6 +51,8 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter { @Bean public MappedInterceptor mappedStatusLoggingInterceptor() { - return new MappedInterceptor(new String[] {"/**"}, statusLoggingInterceptor); + return excludedPaths != null && excludedPaths.length > 0 + ? new MappedInterceptor(new String[] {"/**"}, excludedPaths, statusLoggingInterceptor) + : new MappedInterceptor(new String[] {"/**"}, statusLoggingInterceptor); } } diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml index bc6ce7a48c..ada9dca095 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml +++ b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml @@ -73,3 +73,7 @@ management: prometheus: enabled: true # Whether exporting of metrics to Prometheus is enabled. step: 1m # Step size (i.e. reporting frequency) to use. + +logging: + request-status: + exclusions: [] diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java index 9135d31ac3..c35294db4d 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,6 +24,7 @@ package org.onap.so.adapters.requestsdb.application; import org.onap.logging.filter.spring.LoggingInterceptor; import org.onap.logging.filter.spring.StatusLoggingInterceptor; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -34,6 +35,9 @@ import org.springframework.web.servlet.handler.MappedInterceptor; @ComponentScan(basePackages = {"org.onap.logging.filter"}) public class WebMvcConfig extends WebMvcConfigurerAdapter { + @Value("${logging.request-status.exclusions:}") + private String[] excludedPaths = new String[0]; + @Autowired private LoggingInterceptor loggingInterceptor; @@ -47,6 +51,8 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter { @Bean public MappedInterceptor mappedStatusLoggingInterceptor() { - return new MappedInterceptor(new String[] {"/**"}, statusLoggingInterceptor); + return excludedPaths != null && excludedPaths.length > 0 + ? new MappedInterceptor(new String[] {"/**"}, excludedPaths, statusLoggingInterceptor) + : new MappedInterceptor(new String[] {"/**"}, statusLoggingInterceptor); } } diff --git a/adapters/mso-requests-db-adapter/src/main/resources/application.yaml b/adapters/mso-requests-db-adapter/src/main/resources/application.yaml index 17b014b993..13512ba559 100644 --- a/adapters/mso-requests-db-adapter/src/main/resources/application.yaml +++ b/adapters/mso-requests-db-adapter/src/main/resources/application.yaml @@ -22,7 +22,7 @@ spring: jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb username: ${DB_USERNAME} password: ${DB_PASSWORD} - driver-class-name: org.mariadb.jdbc.Driver + driver-class-name: org.mariadb.jdbc.Driver pool-name: reqdb-pool registerMbeans: true flyway: @@ -43,7 +43,7 @@ spring: username: bpel password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO' role: BPEL-Client - - + - username: mso_admin password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa' role: ACTUATOR @@ -63,3 +63,7 @@ management: prometheus: enabled: true # Whether exporting of metrics to Prometheus is enabled. step: 1m # Step size (i.e. reporting frequency) to use. + +logging: + request-status: + exclusions: [] diff --git a/common/src/main/java/org/onap/so/db/connections/ScheduledDnsLookup.java b/common/src/main/java/org/onap/so/db/connections/ScheduledDnsLookup.java index 725da97d5b..13c27f8722 100644 --- a/common/src/main/java/org/onap/so/db/connections/ScheduledDnsLookup.java +++ b/common/src/main/java/org/onap/so/db/connections/ScheduledDnsLookup.java @@ -32,7 +32,6 @@ public class ScheduledDnsLookup { private static Logger logger = LoggerFactory.getLogger(ScheduledDnsLookup.class); - @ScheduledLogging @Scheduled(fixedRate = 15000) public void performDnsLookup() throws ScheduledTaskException { String dnsUrl = System.getenv(DB_HOST); diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java index 6c98547dea..9cf0fdf7d5 100644 --- a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java +++ b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java @@ -65,7 +65,6 @@ public class ExternalTaskServiceUtils { return Integer.parseInt(env.getProperty("workflow.topics.maxClients", "10")); } - @ScheduledLogging @Scheduled(fixedDelay = 30000) public void checkAllClientsActive() { try { -- 2.16.6