Response logger - HTTP

This filter logs HTTP responses according to its parameter settings. It can log to a file, to a logger, or to standard output.

All parameters are optional.

Parameters

URL pattern

Optional. Can be either a string or a regular expression. The URL(s) of the request for which to log responses. If left blank, then all URLs will qualify.

Examples: /rest/customers regex:/rest/customers/[0-9]+


Methods

Optional. One or more HTTP methods, separated by commas, such as GET, POST, PUT, etc... If this is specified, then only the responses for those requests that use one of the specified methods will be logged. If this is left blank, then all responses will qualify.

Examples: GET POST,PUT,DELETE


Client IPs

Optional. One or more IP address, either literal or as a regular expression, separated by commas or newlines.

Examples: 12.7.50.78,12.7.50.79 regex:12.34.56.\d{1,3} 2600:1701:6440:69f0:57:9a9c:d277:8321


Header patterns

Optional. One or more name:value pairs that should match one of the HTTP headers in the response. If there is more than one, they must be separated by commas or newlines.

The name is a case-insensitive string, and the value can be either a (case-insensitive) string or a regular expression.

Examples: Content-type: application/json Accept-encoding: regex:g?zip.*


Status code patterns

Optional. If specified, this filter will be invoked only if the response's HTTP status code matches one of the patterns specified. Examples:

  • 200

  • 200, 201, 202

  • regex:20\d


Content pattern

Optional. A regular expression that must be matched by the response's body (if present). This only works for text bodies -- if the response contains binary data, the behavior is unspecified.

Examples: <customer>Amanda Jones<customer> "price": ?\d{1,8}\.\d{2}


File name

Optional. If specified, the output for this logging filter is written to the specified file. Keep in mind that Gallium Data runs as a Docker container, and therefore the file name is from the perspective of the Docker container.

Example: /gallium_logs/CustomerRequests.txt


Use timestamp

Optional. If checked, and a file name is specified, a timestamp will be added to the file name before the file extension.


Logger name

Optional. If specified, the output for this logging filter is written to the specified logger, as configured in the log4j configuration file. If the specified logger does not exist, it will be created on the fly.

Example: acme.requests


Format

Optional. The format of the logging messages. This is a string that can contain the following markers:

  • $ts : replaced by a timestamp like 22-11-04 15:07:59.078

  • $method: replaced by the HTTP method of the request, e.g. POST, PUT, etc...

  • $url: replaced by the URL of the request, without the protocol, host or port.

  • $ip: replaced by the client's IP address

  • $payload: replaced by the payload in the response, if present. You can control how much of the payload is logged using the Max payload parameter (see below)

If left blank, the default will be used, which is: $ts [$method $url] $payload


Max payload

Optional. The maximum number of characters in the payload to output to the log. If left blank, the default is 100.


Filter

Optional. A regular expression that all logging messages must satisfy to be written out. If this is specified, any logging messages that do not satisfy this regular expression will be silently dropped.