Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions mdx-gateway-generator/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ com.google.guava:guava:31.0.1-jre=runtimeClasspath,testRuntimeClasspath
com.google.guava:guava:31.1-jre=compileClasspath,testCompileClasspath
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.j2objc:j2objc-annotations:1.3=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:common:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:context:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:gateway-generator:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:gateway:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:messaging:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:platform:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:utilities:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:common:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:context:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:gateway-generator:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:gateway:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:messaging:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:platform:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:utilities:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.squareup:javapoet:1.13.0=runtimeClasspath,testRuntimeClasspath
com.sun.activation:jakarta.activation:1.2.2=runtimeClasspath,testRuntimeClasspath
com.sun.istack:istack-commons-runtime:3.0.12=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
Expand Down
14 changes: 7 additions & 7 deletions mdx-gateways/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ com.google.guava:guava:31.0.1-jre=annotationProcessor
com.google.guava:guava:31.1-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=annotationProcessor,checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.j2objc:j2objc-annotations:1.3=annotationProcessor,checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:common:4.5.1=annotationProcessor,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:context:4.5.1=annotationProcessor,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:gateway-generator:4.5.1=annotationProcessor
com.mx.path-core:gateway:4.5.1=annotationProcessor,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:messaging:4.5.1=annotationProcessor,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:platform:4.5.1=annotationProcessor,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:utilities:4.5.1=annotationProcessor,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:common:4.5.2=annotationProcessor,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:context:4.5.2=annotationProcessor,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:gateway-generator:4.5.2=annotationProcessor
com.mx.path-core:gateway:4.5.2=annotationProcessor,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:messaging:4.5.2=annotationProcessor,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:platform:4.5.2=annotationProcessor,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:utilities:4.5.2=annotationProcessor,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.puppycrawl.tools:checkstyle:8.29=checkstyle
com.squareup:javapoet:1.13.0=annotationProcessor
com.sun.activation:jakarta.activation:1.2.2=annotationProcessor,runtimeClasspath,testRuntimeClasspath
Expand Down
14 changes: 7 additions & 7 deletions mdx-models/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ com.google.guava:guava:28.2-jre=checkstyle
com.google.guava:guava:31.1-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.j2objc:j2objc-annotations:1.3=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:common:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:context:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:gateway:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:messaging:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:platform:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:testing:4.5.1=testCompileClasspath,testRuntimeClasspath
com.mx.path-core:utilities:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:common:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:context:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:gateway:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:messaging:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:platform:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:testing:4.5.2=testCompileClasspath,testRuntimeClasspath
com.mx.path-core:utilities:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.puppycrawl.tools:checkstyle:8.29=checkstyle
com.sun.activation:jakarta.activation:1.2.2=runtimeClasspath,testRuntimeClasspath
com.sun.istack:istack-commons-runtime:3.0.12=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
Expand Down
14 changes: 7 additions & 7 deletions mdx-web/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ com.google.guava:guava:31.1-jre=compileClasspath,runtimeClasspath,testCompileCla
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.j2objc:j2objc-annotations:1.3=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.jayway.jsonpath:json-path:2.7.0=testCompileClasspath,testRuntimeClasspath
com.mx.path-core:common:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:context:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:gateway:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:messaging:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:platform:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:testing:4.5.1=testCompileClasspath,testRuntimeClasspath
com.mx.path-core:utilities:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:common:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:context:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:gateway:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:messaging:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:platform:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:testing:4.5.2=testCompileClasspath,testRuntimeClasspath
com.mx.path-core:utilities:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.puppycrawl.tools:checkstyle:8.29=checkstyle
com.sun.activation:jakarta.activation:1.2.2=runtimeClasspath,testRuntimeClasspath
com.sun.istack:istack-commons-runtime:3.0.12=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

Expand All @@ -25,6 +23,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
import org.springframework.web.util.ContentCachingRequestWrapper;
import org.springframework.web.util.ContentCachingResponseWrapper;
Expand All @@ -35,9 +35,8 @@
* This filter logs incoming requests.
* These values are inserted into the MDC.
*/
// TODO Needs more testing before enabling. This is causing opensearch issues
//@Component
//@Order(FilterOrderSequence.REQUEST_LOGGING_FILTER)
@Component
@Order(FilterOrderSequence.REQUEST_LOGGING_FILTER)
public class PathRequestLoggingFilter extends OncePerRequestFilter {

// Statics
Expand Down Expand Up @@ -156,6 +155,7 @@ private void logRequest(ContentCachingRequestWrapper request, ContentCachingResp
MDC.remove("request_body");
}

MDC.put("api_call_payload", buildApiPayload(response, request));
MDC.put("request_duration", String.valueOf(elapsedTime));
MDC.put("status", String.valueOf(response.getStatus()));

Expand Down Expand Up @@ -190,6 +190,7 @@ private void logRequest(ContentCachingRequestWrapper request, ContentCachingResp
* Resets the MDC by just cleaning up what we place there.
*/
protected void resetMDC() {
MDC.remove("api_call_payload");
MDC.remove("client_guid");
MDC.remove("client_id");
MDC.remove("device_trace_id");
Expand All @@ -212,6 +213,55 @@ protected void resetMDC() {
MDC.remove("user_guid");
}

private String buildApiPayload(ContentCachingResponseWrapper response, ContentCachingRequestWrapper request) {
StringBuilder b = new StringBuilder();
b.append("\n= Request\n\n");
b.append(request.getMethod());
b.append(" ");
b.append(request.getRequestURL());
b.append("\n\n");
if (request.getHeaderNames() != null) {
Map<String, String> requestHeaders = this.buildRequestHeadersMap(request);
Map<String, String> maskedRequestHeaders = this.maskHeaders(requestHeaders);
b.append(this.buildHeaderString(maskedRequestHeaders));
}

String queryString = request.getQueryString();
if (queryString != null) {
Map<String, String> queryParams = this.buildQueryStringMap(queryString);
b.append(this.buildHeaderString(this.maskHeaders(queryParams)));
}

String requestBody = new String(request.getContentAsByteArray(), StandardCharsets.UTF_8);
if (!requestBody.isEmpty()) {
b.append("\n");
b.append(MdxLogMasker.maskPayload(requestBody));
b.append("\n");
}

b.append("\n= Response\n\n");
b.append(response.getStatus());
b.append("\n");
if (response.getHeaderNames() != null) {
Map<String, String> responseHeaders = this.buildResponseHeadersMap(response);
Map<String, String> maskedResponseHeaders = this.maskHeaders(responseHeaders);

if (response.getContentType() != null) {
maskedResponseHeaders.put("Content-Type", response.getContentType());
}

if (!maskedResponseHeaders.isEmpty()) {
b.append(buildHeaderString(maskedResponseHeaders));
}
}

String responseBody = new String(response.getContentAsByteArray(), StandardCharsets.UTF_8);
if (!responseBody.isEmpty()) {
b.append(MdxLogMasker.maskPayload(responseBody));
}
return b.toString();
}

private Map<String, String> buildRequestHeadersMap(HttpServletRequest request) {
final Enumeration<String> headerNames = request.getHeaderNames();
final Map<String, String> headerMap = new HashMap<>();
Expand Down Expand Up @@ -239,14 +289,10 @@ private Map<String, String> buildResponseHeadersMap(HttpServletResponse response

for (String headerName : headerNames) {
final Collection<String> headerValues = response.getHeaders(headerName);
String headerValuesFlattened = "";

if (headerValues != null) {
final List<String> headerValuesList = new ArrayList<>(headerValues);
headerValuesFlattened = String.join(", ", headerValuesList);
headerMap.put(headerName, (String) headerValues.toArray()[0]);
}

headerMap.put(headerName, headerValuesFlattened);
}

return headerMap;
Expand Down
16 changes: 8 additions & 8 deletions realtime/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ com.google.guava:guava:28.2-jre=checkstyle
com.google.guava:guava:31.1-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.j2objc:j2objc-annotations:1.3=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:common:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:context:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:gateway:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:http:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:messaging:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:platform:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:testing:4.5.1=testCompileClasspath,testRuntimeClasspath
com.mx.path-core:utilities:4.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:common:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:context:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:gateway:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:http:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:messaging:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:platform:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.mx.path-core:testing:4.5.2=testCompileClasspath,testRuntimeClasspath
com.mx.path-core:utilities:4.5.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.puppycrawl.tools:checkstyle:8.29=checkstyle
com.sun.activation:jakarta.activation:1.2.2=runtimeClasspath,testRuntimeClasspath
com.sun.istack:istack-commons-runtime:3.0.12=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
Expand Down