From: sourabh_sourabh Date: Fri, 22 Apr 2022 21:47:41 +0000 (+0100) Subject: Security Logging Fields X-Git-Tag: 3.1.0~131 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=cps.git;a=commitdiff_plain;h=ac5ae3e24e347bb6d643e9b4e5ebcf3baa7152a2 Security Logging Fields - logback core and encoder dependencies are added. - New appender is added to log JSON format content on console. Issue-ID: CPS-986 Signed-off-by: sourabh_sourabh Change-Id: Ia72b27f306019fa259b3d6de4c5399f0ae734076 --- diff --git a/cps-application/src/main/resources/application.yml b/cps-application/src/main/resources/application.yml index 4dfeee809..263ae6b3d 100644 --- a/cps-application/src/main/resources/application.yml +++ b/cps-application/src/main/resources/application.yml @@ -124,6 +124,7 @@ management: enabled: true logging: + format: json level: org: springframework: INFO diff --git a/cps-dependencies/pom.xml b/cps-dependencies/pom.xml index dcbc5f70b..73cca2391 100755 --- a/cps-dependencies/pom.xml +++ b/cps-dependencies/pom.xml @@ -200,6 +200,16 @@ mapstruct-processor ${mapstruct.version} + + net.logstash.logback + logstash-logback-encoder + 7.0.1 + + + org.codehaus.janino + janino + 3.1.7 + diff --git a/cps-service/pom.xml b/cps-service/pom.xml index aea122d17..b9d626874 100644 --- a/cps-service/pom.xml +++ b/cps-service/pom.xml @@ -107,6 +107,14 @@ org.springframework.boot spring-boot-starter-aop + + net.logstash.logback + logstash-logback-encoder + + + org.codehaus.janino + janino + org.codehaus.groovy diff --git a/cps-service/src/main/resources/logback-spring.xml b/cps-service/src/main/resources/logback-spring.xml index 3bba9f1bb..ce1af1314 100644 --- a/cps-service/src/main/resources/logback-spring.xml +++ b/cps-service/src/main/resources/logback-spring.xml @@ -1,6 +1,6 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + true + + { + "logTimeStamp": "${currentTimeStamp:-}", + "logTypeName": "", + "logLevel": "%level", + "traceId": "%X{traceId:-}", + "statusCode": "", + "principalId": "${username:-}", + "serviceName": "${springAppName:-}", + "message": "%message", + "spanId": "%X{spanId:-}", + "processId": "${PID:-}", + "threadName": "%thread", + "class": "%logger{40}", + "exception": "%wEx" + } + + + + + - - - ${all-log-pattern} - + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -