code: public String createEventJson(HttpServletRequest request,
                                    HttpServletResponse response,
                                    String tenant,
                                    String userLogin,
                                    String userKey) {
          try {
              String requestBody = getRequestContent(request);
              String responseBody = getResponseContent(response);
  
              Instant startDate = Instant.ofEpochMilli(System.currentTimeMillis() - MdcUtils.getExecTimeMs());
  
              Map<String, Object> data = new LinkedHashMap<>();
              data.put("rid", MdcUtils.getRid());
              data.put("login", userLogin);
              data.put("userKey", userKey);
              data.put("tenant", tenant);
              data.put("msName", appName);
              data.put("operationName", getResourceName(request.getRequestURI())
                  + " " + getOperation(request.getMethod()));
              data.put("operationUrl", request.getRequestURI());
              data.put("operationQueryString", request.getQueryString());
              data.put("startDate", startDate.toString());
              data.put("httpMethod", request.getMethod());
              data.put("requestBody", maskContent(requestBody, request.getRequestURI(), true, request.getMethod()));
              data.put("requestLength", requestBody.length());
              data.put("responseBody", maskContent(responseBody, request.getRequestURI(), false, request.getMethod()));
              data.put("responseLength", responseBody.length());
              data.put("requestHeaders", getRequestHeaders(request));
              data.put("responseHeaders", getResponseHeaders(response));
              data.put("httpStatusCode", response.getStatus());
              data.put("channelType", "HTTP");
              data.put("entityId", getEntityField(responseBody, "id"));
              data.put("entityKey", getEntityField(responseBody, "key"));
              data.put("entityTypeKey", getEntityField(responseBody, "typeKey"));
              data.put("execTime", MdcUtils.getExecTimeMs());
  
              return mapper.writeValueAsString(data);
          } catch (Exception e) {
              log.warn("Error creating timeline event", e);
          }
          return null;
      }
docs: Create event json string.
  
  @param request  the http request
  @param response the http response