FTPClient
FTPFileInfo
HTTPClient
HTTPClientLoggingConfig
HTTPRequestPart
Mail
SFTPClient
SFTPFileInfo
WebDAVClient
WebDAVFileInfo
DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
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:
1var config = new dw.net.HTTPClientLoggingConfig();
2// Enable logging and set level
3config.setEnabled(true);
4config.setLevel("INFO");
5// Configure sensitive JSON fields
6config.setSensitiveJsonFields(["password", "creditCard", "ssn"]);
7// Configure sensitive XML fields
8config.setSensitiveXmlFields(["password", "creditCard", "ssn"]);
9// Configure sensitive headers
10config.setSensitiveHeaders(["authorization", "x-api-key", "cookie"]);
11// Configure sensitive body fields (for form data)
12config.setSensitiveBodyFields(["password", "creditCard", "ssn"]);
13// Configure text patterns for plain text/HTML content
14config.setSensitiveTextPatterns([["password\\s*=\\s*[^\\s&]+"]]);Content Type Support:
| Property | Description |
|---|---|
| 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. |
| Constructor | Description |
|---|---|
| HTTPClientLoggingConfig() | Creates a new HTTPClientLoggingConfig instance. |
| Method | Description |
|---|---|
| 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
Gets whether HTTP client logging is enabled.
Gets the current log level for HTTP client logging.
Gets the sensitive body fields configured for form data redaction.
Gets the sensitive headers configured for redaction.
Gets the sensitive JSON fields configured for redaction.
Gets the sensitive XML fields configured for redaction.
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
Gets the current log level for HTTP client logging.
Returns:
Gets the sensitive body fields configured for form data redaction.
Returns:
Gets the sensitive headers configured for redaction.
Returns:
Gets the sensitive JSON fields configured for redaction.
Returns:
Gets the sensitive XML fields configured for redaction.
Returns:
Gets whether HTTP client logging is enabled.
Returns:
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:
Sets the log level for HTTP client logging.
The log level determines the verbosity of HTTP logging output. Available levels:
Parameters:
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:
1config.setSensitiveBodyFields(["fname", "creditCard", "ssn_last_4"]);Parameters:
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:
1config.setSensitiveHeaders([ "x-api-key", "x-auth-token"]);
2config.setSensiviteHeaders([]);Parameters:
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:
1config.setSensitiveJsonFields(["password", "creditCard", "ssn"]);Parameters:
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:
1config.setSensitiveTextPatterns(["password", "credit.*card", "\\d{3}-\\d{2}-\\d{4}"]);Parameters:
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:
1config.setSensitiveXmlFields(["password", "creditCard", "ssn"]);Parameters: