aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2020-05-14 14:09:40 +0000
committerGerrit Code Review <gerrit@onap.org>2020-05-14 14:09:40 +0000
commit40d0e02c799115c2f070e93d35a9384264b332e2 (patch)
treeab017cf5a93dfab050bb544b818a918ebc97c373
parent023a9a7398957caeecaafaf9083392e49a4b6262 (diff)
parent195760a93887a3b7a3e3a6b9fd997d9ec8f9bb01 (diff)
Merge "requestid values have commas audit log"
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy1
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy1
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy1
-rw-r--r--common/src/main/java/org/onap/so/logging/tasks/AuditMDCSetup.java3
-rw-r--r--cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java7
-rw-r--r--cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java74
-rw-r--r--deployment-configs/src/main/resources/logger/logback-spring.xml6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java1
-rw-r--r--pom.xml6
11 files changed, 14 insertions, 90 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
index 7b49fa06b3..91f73e2306 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
@@ -443,7 +443,6 @@ class CatalogDbUtils {
String queryEndpoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + endPoint
def responseData = ''
HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), ONAPComponents.CATALOG_DB)
- client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', "BPMN")
client.addAdditionalHeader('Accept', MediaType.APPLICATION_JSON)
String basicAuthCred = execution.getVariable("BasicAuthHeaderValueDB")
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
index a5111a62d3..b390f7675a 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
@@ -186,7 +186,6 @@ class ExternalAPIUtil {
HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), ONAPComponents.AAI)
httpClient.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey"))
httpClient.addAdditionalHeader("X-FromAppId", "MSO")
- httpClient.addAdditionalHeader("X-TransactionId", uuid)
httpClient.addAdditionalHeader("Target",execution.getVariable("SPPartnerUrl"))
apiResponse = httpClient.post(payload)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
index ebaf65ff81..55f1187d69 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
@@ -224,9 +224,6 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
URL url = new URL(sdncAdapterUrl)
HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SDNC_ADAPTER)
- httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id"))
- httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString())
- httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-SDNCAdapter")
httpClient.addAdditionalHeader("mso-request-id", execution.getVariable("mso-request-id"))
httpClient.addAdditionalHeader("mso-service-instance-id", execution.getVariable("mso-service-instance-id"))
httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue"))
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
index fda6b8e6e3..216f34573b 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
@@ -136,7 +136,6 @@ class CatalogDbUtilsTest {
}
private void verifyHeadersInHttpClient() {
- verify(httpClientMock).addAdditionalHeader(eq(ONAPLogConstants.Headers.REQUEST_ID), anyString())
verify(httpClientMock).addAdditionalHeader("X-FromAppId", "BPMN")
verify(httpClientMock).addAdditionalHeader("Accept", MediaType.APPLICATION_JSON)
verify(httpClientMock).addAdditionalHeader("Authorization", AUTHORIZATION_HEADER)
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy
index 7abfcffb13..e6d5fb86e6 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy
@@ -129,7 +129,6 @@ class ExternalAPIUtilTest {
// THEN
then(httpClient).should(times(1)).addBasicAuthHeader("value_externalapi_auth", "value_mso_msoKey")
then(httpClient).should(times(1)).addAdditionalHeader("X-FromAppId", "MSO")
- then(httpClient).should(times(1)).addAdditionalHeader("X-TransactionId", UUID_STR)
ResponseAssert.assertThat(apiResponse)
.hasStatusCode(HttpStatus.ACCEPTED)
.hasBody(BODY_PAYLOAD)
diff --git a/common/src/main/java/org/onap/so/logging/tasks/AuditMDCSetup.java b/common/src/main/java/org/onap/so/logging/tasks/AuditMDCSetup.java
index 8d98307a43..39d208b1dd 100644
--- a/common/src/main/java/org/onap/so/logging/tasks/AuditMDCSetup.java
+++ b/common/src/main/java/org/onap/so/logging/tasks/AuditMDCSetup.java
@@ -3,6 +3,7 @@ package org.onap.so.logging.tasks;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
+import java.util.UUID;
import org.camunda.bpm.client.task.ExternalTask;
import org.onap.logging.filter.base.MDCSetup;
import org.onap.logging.filter.base.ONAPComponents;
@@ -30,6 +31,7 @@ public class AuditMDCSetup {
MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, externalTask.getTopicName());
MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, ONAPComponents.OPENSTACK_ADAPTER.toString());
setResponseCode(ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
+ MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, UUID.randomUUID().toString());
setElapsedTime();
mdcSetup.setServerFQDN();
logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
@@ -53,5 +55,4 @@ public class AuditMDCSetup {
MDC.remove(ONAPLogConstants.MDCs.ELAPSED_TIME);
MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME);
}
-
}
diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
index d1f509f476..1e1c8a7de1 100644
--- a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
+++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
@@ -31,6 +31,7 @@ import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.Phase;
import org.apache.cxf.transport.http.AbstractHTTPDestination;
+import org.onap.logging.filter.base.MDCSetup;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -48,7 +49,7 @@ public class SOAPLoggingInInterceptor extends AbstractSoapInterceptor {
@Override
public void handleMessage(SoapMessage message) throws Fault {
try {
- SOAPMDCSetup mdcSetup = new SOAPMDCSetup();
+ MDCSetup mdcSetup = new MDCSetup();
Map<String, List<String>> headers = (Map<String, List<String>>) message.get(Message.PROTOCOL_HEADERS);
HttpServletRequest request = (HttpServletRequest) message.get(AbstractHTTPDestination.HTTP_REQUEST);
request.getRemoteAddr();
@@ -59,8 +60,10 @@ public class SOAPLoggingInInterceptor extends AbstractSoapInterceptor {
setMDCPartnerName(headers);
mdcSetup.setServerFQDN();
mdcSetup.setClientIPAddress(request);
- mdcSetup.setInstanceUUID();
+ mdcSetup.setInstanceID();
mdcSetup.setEntryTimeStamp();
+ mdcSetup.setLogTimestamp();
+ mdcSetup.setElapsedTime();
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, "INPROGRESS");
logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
} catch (Exception e) {
diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java
deleted file mode 100644
index 8258ce6f99..0000000000
--- a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.logging.cxf.interceptor;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.time.ZoneOffset;
-import java.time.ZonedDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.UUID;
-import javax.servlet.http.HttpServletRequest;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-
-
-
-public class SOAPMDCSetup {
-
- protected static Logger logger = LoggerFactory.getLogger(SOAPMDCSetup.class);
-
- private static final String INSTANCE_UUID = UUID.randomUUID().toString();
-
- public void setInstanceUUID() {
- MDC.put(ONAPLogConstants.MDCs.INSTANCE_UUID, INSTANCE_UUID);
- }
-
- public void setServerFQDN() {
- String serverFQDN = "";
- InetAddress addr = null;
- try {
- addr = InetAddress.getLocalHost();
- serverFQDN = addr.toString();
- } catch (UnknownHostException e) {
- logger.warn("Cannot Resolve Host Name");
- serverFQDN = "";
- }
- MDC.put(ONAPLogConstants.MDCs.SERVER_FQDN, serverFQDN);
- }
-
- public void setClientIPAddress(HttpServletRequest httpServletRequest) {
- String remoteIpAddress = "";
- if (httpServletRequest != null) {
- remoteIpAddress = httpServletRequest.getRemoteAddr();
- }
- MDC.put(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS, remoteIpAddress);
- }
-
- public void setEntryTimeStamp() {
- MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,
- ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
- }
-
-
-}
diff --git a/deployment-configs/src/main/resources/logger/logback-spring.xml b/deployment-configs/src/main/resources/logger/logback-spring.xml
index 258382b834..bd9712ad87 100644
--- a/deployment-configs/src/main/resources/logger/logback-spring.xml
+++ b/deployment-configs/src/main/resources/logger/logback-spring.xml
@@ -52,7 +52,8 @@
<appender name="Audit"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>ENTRY</marker>
<marker>EXIT</marker>
</evaluator>
<onMismatch>DENY</onMismatch>
@@ -80,7 +81,8 @@
<appender name="Metric"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>INVOKE</marker>
<marker>INVOKE-RETURN</marker>
</evaluator>
<onMismatch>DENY</onMismatch>
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
index f0943393ed..7aa6e0f831 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
@@ -108,7 +108,6 @@ public class SDCClientHelper {
HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.SDC);
httpClient.addBasicAuthHeader(sdcClientAuth, msoKey);
httpClient.addAdditionalHeader("X-ECOMP-InstanceID", sdcActivateInstanceId);
- httpClient.addAdditionalHeader("X-ECOMP-RequestID", UUID.randomUUID().toString());
httpClient.addAdditionalHeader("Content-Type", SDCClientHelper.SDC_CONTENT_TYPE);
httpClient.addAdditionalHeader("Accept", SDCClientHelper.SDC_ACCEPT_TYPE);
httpClient.addAdditionalHeader("USER_ID", sdcActivateUserId);
diff --git a/pom.xml b/pom.xml
index 3aca7aff8a..14582a4d2f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -823,17 +823,17 @@
<dependency>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-slf4j</artifactId>
- <version>1.6.6</version>
+ <version>1.6.7-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-filter-base</artifactId>
- <version>1.6.6</version>
+ <version>1.6.7-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-filter-spring</artifactId>
- <version>1.6.6</version>
+ <version>1.6.7-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>