Reduce SO log noise 98/141398/4
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Mon, 30 Jun 2025 11:12:55 +0000 (13:12 +0200)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Mon, 30 Jun 2025 12:26:23 +0000 (14:26 +0200)
- 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 <Fiete.Ostkamp@telekom.de>
Change-Id: I491aa4b6e9d4ec2ce02e3559026edfad9bfa229c

adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
adapters/mso-catalog-db-adapter/src/main/resources/application.yaml
adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java
adapters/mso-requests-db-adapter/src/main/resources/application.yaml
common/src/main/java/org/onap/so/db/connections/ScheduledDnsLookup.java
common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java

index cd3b2a3..e464082 100644 (file)
@@ -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);
     }
 }
index bc6ce7a..ada9dca 100644 (file)
@@ -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: []
index 9135d31..c35294d 100644 (file)
@@ -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);
     }
 }
index 17b014b..13512ba 100644 (file)
@@ -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: []
index 725da97..13c27f8 100644 (file)
@@ -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);
index 6c98547..9cf0fdf 100644 (file)
@@ -65,7 +65,6 @@ public class ExternalTaskServiceUtils {
         return Integer.parseInt(env.getProperty("workflow.topics.maxClients", "10"));
     }
 
-    @ScheduledLogging
     @Scheduled(fixedDelay = 30000)
     public void checkAllClientsActive() {
         try {