Class HTTPClientLoggingConfig

Script API for configuring HTTP client logging and sensitive data redaction.

This class provides a customer-facing interface for configuring HTTP client logging behavior, including enabling/disabling logging, setting log levels, and defining sensitive fields that should be redacted from HTTP request and response bodies.

Security Note: This class handles sensitive security-related data and logging configuration. Pay special attention to PCI DSS requirements when configuring sensitive field redaction to ensure proper data protection. Sensitive Fields of appropriate types MUST be set else logging will be skipped.

Usage Example:

Content Type Support:

  • **JSON:**Use setSensitiveJsonFields() to specify field names to redact
  • **XML:**Use setSensitiveXmlFields() to specify element/attribute names to redact
  • **Form Data:**Use setSensitiveBodyFields() to specify parameter names to redact
  • **Plain Text/HTML:**Use setSensitiveTextPatterns() to specify regex patterns
  • **Binary/Multipart:**Entire body is automatically treated as sensitive
PropertyDescription
enabled: BooleanGets whether HTTP client logging is enabled.
level: StringGets the current log level for HTTP client logging.
sensitiveBodyFields: String[]Gets the sensitive body fields configured for form data redaction.
sensitiveHeaders: String[]Gets the sensitive headers configured for redaction.
sensitiveJsonFields: String[]Gets the sensitive JSON fields configured for redaction.
sensitiveXmlFields: String[]Gets the sensitive XML fields configured for redaction.
ConstructorDescription
HTTPClientLoggingConfig()Creates a new HTTPClientLoggingConfig instance.
MethodDescription
getLevel()Gets the current log level for HTTP client logging.
getSensitiveBodyFields()Gets the sensitive body fields configured for form data redaction.
getSensitiveHeaders()Gets the sensitive headers configured for redaction.
getSensitiveJsonFields()Gets the sensitive JSON fields configured for redaction.
getSensitiveXmlFields()Gets the sensitive XML fields configured for redaction.
isEnabled()Gets whether HTTP client logging is enabled.
setEnabled(Boolean)Sets whether HTTP client logging is enabled.
setLevel(String)Sets the log level for HTTP client logging.
setSensitiveBodyFields(String[])Sets the sensitive body fields that should be redacted from HTTP form data.
setSensitiveHeaders(String[])Sets the sensitive headers that should be redacted from HTTP requests/responses.
setSensitiveJsonFields(String[])Sets the sensitive JSON fields that should be redacted from HTTP request/response bodies.
setSensitiveTextPatterns(String[])Sets the sensitive text patterns that should be redacted from HTTP request/response bodies.
setSensitiveXmlFields(String[])Sets the sensitive XML fields that should be redacted from HTTP request/response bodies.

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

enabled: Boolean

Gets whether HTTP client logging is enabled.


level: String

Gets the current log level for HTTP client logging.


sensitiveBodyFields: String[]

Gets the sensitive body fields configured for form data redaction.


sensitiveHeaders: String[]

Gets the sensitive headers configured for redaction.


sensitiveJsonFields: String[]

Gets the sensitive JSON fields configured for redaction.


sensitiveXmlFields: String[]

Gets the sensitive XML fields configured for redaction.


HTTPClientLoggingConfig()

Creates a new HTTPClientLoggingConfig instance.

The public constructor should only be called from JavaScript, but cfgAPI uses this constructor for creating the Service instance -> so fill the factory here


getLevel(): String

Gets the current log level for HTTP client logging.

Returns:

  • the log level as a string (DEBUG, INFO, WARN, ERROR)

getSensitiveBodyFields(): String[]

Gets the sensitive body fields configured for form data redaction.

Returns:

  • an array of field names that will be redacted from form data

getSensitiveHeaders(): String[]

Gets the sensitive headers configured for redaction.

Returns:

  • an array of header names that will be redacted

getSensitiveJsonFields(): String[]

Gets the sensitive JSON fields configured for redaction.

Returns:

  • an array of field names that will be redacted from JSON content

getSensitiveXmlFields(): String[]

Gets the sensitive XML fields configured for redaction.

Returns:

  • an array of field names that will be redacted from XML content

isEnabled(): Boolean

Gets whether HTTP client logging is enabled.

Returns:

  • true if logging is enabled, false otherwise

setEnabled(enabled: Boolean): void

Sets whether HTTP client logging is enabled.

When enabled, HTTP requests and responses will be logged according to the configured log level and sensitive field redaction settings. When disabled, no HTTP logging will occur.

Parameters:

  • enabled - true to enable logging, false to disable

setLevel(level: String): void

Sets the log level for HTTP client logging.

The log level determines the verbosity of HTTP logging output. Available levels:

  • **DEBUG:**Most verbose, includes detailed request/response information
  • **INFO:**Standard level, includes basic request/response details
  • **WARN:**Only logs warnings and errors
  • **ERROR:**Only logs errors

Parameters:

  • level - the log level (DEBUG, INFO, WARN, ERROR). Case-insensitive.

setSensitiveBodyFields(fields: String[]): void

Sets the sensitive body fields that should be redacted from HTTP form data.

When HTTP requests or responses contain form data (application/x-www-form-urlencoded), any parameters matching the specified field names will be redacted with "****FILTERED****" in the logs. Sensitive Field MUST be set else logging will be skipped for form body type Setting with empty array will use default values ["name", "email", "email_address", "ssn", "first_name", "last_name"]

Example:

Parameters:

  • fields - an array of field names to redact from form data

setSensitiveHeaders(headers: String[]): void

Sets the sensitive headers that should be redacted from HTTP requests/responses.

Any HTTP headers matching the specified names will be redacted with "****FILTERED****" in the logs. This is useful for protecting sensitive authentication tokens, API keys, and session information. Sensitive Headers MUST be set else logging will be skipped for headers Setting the sensitive headers with empty array will use default values ["authorization", "cookie"]

Example:

Parameters:

  • headers - an array of header names to redact

setSensitiveJsonFields(fields: String[]): void

Sets the sensitive JSON fields that should be redacted from HTTP request/response bodies.

When HTTP requests or responses contain JSON content, any fields matching the specified names will be redacted with "****FILTERED****" in the logs. Sensitive Field MUST be set else logging will be skipped for JSON body type Setting with empty array will use default values ["name", "email", "email_address", "ssn", "first_name", "last_name", "password"]

Example:

Parameters:

  • fields - an array of field names to redact from JSON content

setSensitiveTextPatterns(patterns: String[]): void

Sets the sensitive text patterns that should be redacted from HTTP request/response bodies.

When HTTP requests or responses contain text content, any text matching the specified regex patterns will be redacted with "****FILTERED****" in the logs.

Example:

Parameters:

  • patterns - an array of regex patterns to match and redact from text content

setSensitiveXmlFields(fields: String[]): void

Sets the sensitive XML fields that should be redacted from HTTP request/response bodies.

When HTTP requests or responses contain XML content, any elements or attributes matching the specified names will be redacted with "****FILTERED****" in the logs. Sensitive Field MUST be set else logging will be skipped for XML body type Setting with empty array will use default values ["name", "email", "email_address", "ssn", "first_name", "last_name", "password"]

Example:

Parameters:

  • fields - an array of element/attribute names to redact from XML content