Class HttpRequestLogEntry

java.lang.Object
java.util.AbstractMap<String,Object>
java.util.HashMap<String,Object>
net.targetr.rc.monitoring.logs.http.HttpRequestLogEntry
All Implemented Interfaces:
Serializable, Cloneable, Map<String,Object>

public class HttpRequestLogEntry extends HashMap<String,Object>
Represents a log entry for an HTTP request.
See Also:
  • Constructor Details

    • HttpRequestLogEntry

      public HttpRequestLogEntry()
      Constructs a new HTTP request log entry.
  • Method Details

    • getSanitised

      public HttpRequestLogEntry getSanitised()
      Gets a sanitised version of this log entry.
      Returns:
      a sanitised version of this log entry
    • toJson

      public String toJson()
      Serializes this HTTP request log entry to JSON.
      Returns:
      the JSON representation of this object
    • toCommonLogFormat

      public String toCommonLogFormat()
      Formats this entry as an NCSA Combined Log Format line.

      Format: host - - [dd/MMM/yyyy:HH:mm:ss Z] "method uri version" status bytes "referer" "user-agent"

      Returns:
      the Combined Log Format string
    • sanitize

      public static void sanitize(Map<String,Object> input, Map<String,Object> output)
      Sanitizes a map of header values based on the header key.
      Parameters:
      input - The map of header values
      output - The map to populate with sanitized values
    • sanitize

      public static void sanitize(String key, List<String> input, List<String> output)
      Sanitizes a list of header values based on the header key.
      Parameters:
      key - The header key
      input - The list of header values
      output - The list to populate with sanitized values
    • sanitize

      public static String sanitize(String key, String value)
      Sanitizes a header value based on the header key.
      Parameters:
      key - The header key
      value - The header value
      Returns:
      The sanitized header value
    • santizeRoomAndClient

      public static String santizeRoomAndClient(String uri)
      Masks r and c query parameter values while preserving the rest of the URI.
      Parameters:
      uri - The input URI
      Returns:
      The URI with r values replaced by "XXXX-XXXX" and c values by "XXXXXXXX"