Class HttpRequestLogEntry
- All Implemented Interfaces:
Serializable,Cloneable,Map<String,Object>
Represents a log entry for an HTTP request.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets a sanitised version of this log entry.static StringSanitizes a header value based on the header key.static voidSanitizes a list of header values based on the header key.static voidSanitizes a map of header values based on the header key.static StringMasks r and c query parameter values while preserving the rest of the URI.Formats this entry as an NCSA Combined Log Format line.toJson()Serializes this HTTP request log entry to JSON.Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, newHashMap, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Constructor Details
-
HttpRequestLogEntry
public HttpRequestLogEntry()Constructs a new HTTP request log entry.
-
-
Method Details
-
getSanitised
Gets a sanitised version of this log entry.- Returns:
- a sanitised version of this log entry
-
toJson
Serializes this HTTP request log entry to JSON.- Returns:
- the JSON representation of this object
-
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
Sanitizes a map of header values based on the header key.- Parameters:
input- The map of header valuesoutput- The map to populate with sanitized values
-
sanitize
Sanitizes a list of header values based on the header key.- Parameters:
key- The header keyinput- The list of header valuesoutput- The list to populate with sanitized values
-
sanitize
Sanitizes a header value based on the header key.- Parameters:
key- The header keyvalue- The header value- Returns:
- The sanitized header value
-
santizeRoomAndClient
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"
-