From 07c8609b17e31296b4a2664999c00d8c5aa8bdc5 Mon Sep 17 00:00:00 2001 From: Ivor D'Souza Date: Sun, 27 Oct 2024 18:01:48 +0000 Subject: [PATCH 1/2] feat(elk-stack-setup): add ecs logging for elastic setup --- pom.xml | 12 +++---- src/main/resources/application.properties | 3 ++ src/main/resources/logback-spring.xml | 21 ++++++++++++ src/main/resources/logback.xml | 32 ------------------- .../WEB-INF/jboss-deployment-structure.xml | 8 +++++ 5 files changed, 38 insertions(+), 38 deletions(-) create mode 100644 src/main/resources/logback-spring.xml delete mode 100644 src/main/resources/logback.xml create mode 100644 src/main/webapp/WEB-INF/jboss-deployment-structure.xml diff --git a/pom.xml b/pom.xml index 9a3aa8a..600829e 100644 --- a/pom.xml +++ b/pom.xml @@ -55,12 +55,12 @@ org.springframework.boot spring-boot-starter - - - org.springframework.boot - spring-boot-starter-logging - - + + + + co.elastic.logging + logback-ecs-encoder + 0.4.0 diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 461e6a1..becbeae 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -48,3 +48,6 @@ logging.level.org.springframework.web=INFO logging.level.org.hibernate=INFO logging.level.com.iemr=DEBUG logging.level.org.springframework=INFO + +logging.path=logs/ +logging.file.name=logs/helpline1097-api.log diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..232d479 --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,21 @@ + + + + + + ${LOG_FILE}.json + + ${LOG_FILE}.json.%d{yyyy-MM-dd}.gz + 10MB + 0 + 10MB + true + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml deleted file mode 100644 index 78302a2..0000000 --- a/src/main/resources/logback.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - ${HOME_LOG} - - - logs/archived/app.%d{yyyy-MM-dd}.%i.log.gz - - 1MB - - 20GB - - 60 - - - - %d %-5p [%X{sessionId}] [%X{userId}] %C{1}.%M:%L] %m%n - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/src/main/webapp/WEB-INF/jboss-deployment-structure.xml new file mode 100644 index 0000000..545b679 --- /dev/null +++ b/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file From a4f459fc9f1f0d6a73ba7814ca3486a3bc0ee3a9 Mon Sep 17 00:00:00 2001 From: Ivor D'Souza Date: Thu, 31 Oct 2024 01:49:23 +0000 Subject: [PATCH 2/2] fix bot suggestions --- pom.xml | 2 +- src/main/resources/logback-spring.xml | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index 600829e..a144db2 100644 --- a/pom.xml +++ b/pom.xml @@ -60,7 +60,7 @@ co.elastic.logging logback-ecs-encoder - 0.4.0 + 1.3.2 diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 232d479..50aecbc 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -1,21 +1,27 @@ - - - + + + ${LOG_FILE}.json ${LOG_FILE}.json.%d{yyyy-MM-dd}.gz - 10MB + 100MB 0 - 10MB true - + + + + + 512 + 0 + false - - + + \ No newline at end of file