Add implementation for mandatory MDC default value 39/3739/2 2.0.7
authorGUPTA <pg0057291@techmahindra.com>
Tue, 5 Feb 2019 17:15:45 +0000 (12:15 -0500)
committerGUPTA <pg0057291@techmahindra.com>
Thu, 7 Feb 2019 17:07:01 +0000 (12:07 -0500)
Bump ELK stack version to 2.0.7

Issue-ID: ACUMOS-2458

Change-Id: Ifa4686fc9a04e6bdff51dc7c6ab121bd6baa2e86
Signed-off-by: GUPTA <pg0057291@techmahindra.com>
docs/release-notes.rst
elk-stack/elasticsearch/pom.xml
elk-stack/kibana/pom.xml
elk-stack/logstash/pom.xml
filebeat/pom.xml
logging-demo/pom.xml
logging-demo/src/main/java/org/acumos/demo/logging/Execute.java
logging-demo/src/main/java/org/acumos/demo/logging/util/ACUMOSLogConstants.java
metricbeat/pom.xml

index cb2c6f5..fd9ff5b 100644 (file)
 Platform Operations, Administration, and Management (OA&M) Release Notes
 ========================================================================
 
+Version 2.0.7, 07 February 2019
+-------------------------------
+* Add implementation for mandatory MDC default value in logging POC and bump ELK stack version to 2.0.7(`ACUMOS-2458 <https://jira.acumos.org/browse/ACUMOS-2458>`_)
+
 Version 2.0.4, 24 January 2019
 -------------------------------
 * Update logstash queries for database version 2.0.4 (`ACUMOS-2403 <https://jira.acumos.org/browse/ACUMOS-2403>`_)
index 411d9e8..de189e7 100644 (file)
@@ -25,7 +25,7 @@
         <!-- docker image name -->
         <artifactId>acumos-elasticsearch</artifactId>
         <!-- docker tag -->
-        <version>2.0.4-SNAPSHOT</version>
+        <version>2.0.7-SNAPSHOT</version>
 </project>
 
 
index 1a82d6a..6325ad1 100644 (file)
@@ -25,7 +25,7 @@
         <!-- docker image name -->
         <artifactId>acumos-kibana</artifactId>
         <!-- docker tag -->
-        <version>2.0.4-SNAPSHOT</version>
+        <version>2.0.7-SNAPSHOT</version>
 </project>
 
 
index a22e350..149420e 100644 (file)
@@ -25,5 +25,5 @@
         <!-- docker image name -->
         <artifactId>acumos-logstash</artifactId>
         <!-- docker tag -->
-        <version>2.0.4-SNAPSHOT</version>
+        <version>2.0.7-SNAPSHOT</version>
 </project>
index b42ad2a..9e3ca43 100644 (file)
@@ -25,7 +25,7 @@
         <!-- docker image name -->
         <artifactId>acumos-filebeat</artifactId>
         <!-- docker tag -->
-        <version>2.0.4-SNAPSHOT</version>
+        <version>2.0.7-SNAPSHOT</version>
 </project>
 
 
index 79214ed..fa0b888 100644 (file)
@@ -23,7 +23,7 @@
 
        <groupId>org.acumos.platform-oam</groupId>
        <artifactId>logging-demo</artifactId>
-       <version>0.0.1-SNAPSHOT</version>
+       <version>2.0.7-SNAPSHOT</version>
        <packaging>jar</packaging>
        <name>logging-demo</name>
        <description>Demo project for Logging</description>
index 74b2312..ccf614c 100644 (file)
@@ -21,6 +21,7 @@ package org.acumos.demo.logging;
 
 import java.util.UUID;
 import org.acumos.demo.logging.service.ApplicationService;
+import org.acumos.demo.logging.util.ACUMOSLogConstants;
 import org.acumos.demo.logging.util.ACUMOSLogConstants.MDCs;
 import org.slf4j.MDC;
 import org.springframework.boot.CommandLineRunner;
@@ -38,12 +39,8 @@ public class Execute implements CommandLineRunner {
        public void run(String... args) {
 
                String txId = UUID.randomUUID().toString();
-
-               MDC.put(MDCs.REQUEST_ID, txId);
-               MDC.put(MDCs.RESPONSE_CODE, "500");
-               MDC.put(MDCs.RESPONSE_DESCRIPTION, "Internal Server Error");
-               MDC.put(MDCs.RESPONSE_SEVERITY, "ERROR");
-               MDC.put(MDCs.STATUS_CODE, "ERROR");
+               ACUMOSLogConstants.setDefaultMDCs();
+               MDC.put(MDCs.REQUEST_ID, txId);         
                MDC.put(MDCs.TARGET_ENTITY, "Onboarding");
                MDC.put(MDCs.TARGET_SERVICE_NAME, "Onboarding/api/v2");
                MDC.put(MDCs.CLIENT_IP_ADDRESS, "127.0.0.1");
index 7ff2794..57d3eae 100644 (file)
@@ -21,6 +21,8 @@ package org.acumos.demo.logging.util;
 
 import org.slf4j.Marker;
 import org.slf4j.MarkerFactory;
+import org.slf4j.MDC;
+
 
 /**
  * Constants for standard ACUMOS headers, MDCs, etc.
@@ -120,7 +122,7 @@ public final class ACUMOSLogConstants {
                /** MDC reporting outcome error level. */
                public static final String RESPONSE_SEVERITY = "Severity";
 
-               /** MDC reporting outcome error level. */
+               /** MDC reporting outcome status of the request. */
                public static final String STATUS_CODE = "StatusCode";
 
                // Unsorted. ///////////////////////////////////////////////////////////
@@ -149,6 +151,16 @@ public final class ACUMOSLogConstants {
                }
        }
 
+       /**
+        * Overrideable method to set MDCs based on property values.
+        */
+       public static void setDefaultMDCs() {
+               MDC.put(MDCs.RESPONSE_CODE, "200");
+               MDC.put(MDCs.RESPONSE_DESCRIPTION, "200 OK");
+               MDC.put(MDCs.RESPONSE_SEVERITY, ResponseSeverity.INFO.toString());
+               MDC.put(MDCs.STATUS_CODE, ResponseStatus.INPROGRESS.toString());
+       }
+
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //
        // Enums.
@@ -156,20 +168,28 @@ public final class ACUMOSLogConstants {
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
        /**
-        * Response success or not, for setting <tt>StatusCode</tt>.
+        * Response success or not, for setting StatusCode.
         */
        public enum ResponseStatus {
-
-               /** Success. */
+               
                COMPLETED,
-
-               /** Not. */
                ERROR,
-
-               /** In Progress. */
                INPROGRESS
        }
 
+       /**
+        * Response of log level, for setting Severity.
+        */
+       public enum ResponseSeverity {
+
+               INFO,
+               ERROR,
+               TRACE,
+               DEBUG,
+               WARN,
+               FATAL
+       }
+
        /**
         * Synchronous or asynchronous execution, for setting invocation marker.
         */
index 19195c0..c27e212 100644 (file)
@@ -25,7 +25,7 @@
         <!-- docker image name -->
         <artifactId>acumos-metricbeat</artifactId>
         <!-- docker tag -->
-        <version>2.0.4-SNAPSHOT</version>
+        <version>2.0.7-SNAPSHOT</version>
 </project>