Stdout Log
Overview​
The stdout-log policy is used to log API request and response data to the console (standard output). It provides detailed logging of headers, bodies, and custom fields during request processing. This is useful for debugging and monitoring purposes, especially when diagnosing failures or tracking data flow across services. However, caution is advised since logging large request/response payloads can lead to performance issues or excessive log volumes.
This policy can selectively log full bodies, headers, or only error responses, and it supports both custom field injection and masking of sensitive data.
Configuration Details​
Field | Type | Description |
---|---|---|
withBodyLog | Toggle | Logs both request and response bodies when enabled. May lead to large log volumes. |
withHeaderLog | Toggle | Logs request headers when enabled. |
withErrorBodyLog | Toggle | When enabled, logs request/response bodies only for failed responses (HTTP status code >= 300), |
customFields | JSON Editor | Allows insertion of additional custom fields into the log data. The value must be valid JSON. Example: "request_uri": "xyz" |
maskingFields | Form | Defines fields to be masked in the logs for privacy. Applies to Request Body, Response Body, or Request Headers. Requires withBodyLog or withHeaderLog to be enabled. |
Cannot be changed: Toggle to prevent this policy from being removed.
Cannot change the setting value: Toggle to prevent changes to the configuration values after setup.
If withBodyLog or withHeaderLog is disabled while masking is still active, a warning modal will appear suggesting removal of masking rules to avoid logging inconsistencies.
Masking Fields Options​
Each masking rule requires:
- Type: One of Request Body, Response Body, or Request Headers.
- Field Name: The field to mask (e.g., account, phone).
- Masking Value: The value to replace the field with (e.g., *** or masked pattern).
User can click on the blue add button to add new masking field to configure or click on the red minus button on corresponding field to remove.
Examples​
Logging All Payloads​
"withBodyLog": true,
"withHeaderLog": true,
"withErrorBodyLog": false
- Logs request and response bodies and all headers for every request.
- Suitable for development environments.
Error-Only Logging​
"withErrorBodyLog": true
- Logs body and headers only if the response status is 300 or above.
- Helps reduce log volume while still capturing important errors.
Custom Fields in Logs​
{
"customFields": {
"request_id": "abc123",
"env": "staging"
}
}
- Adds custom metadata into each log entry.
Masking Sensitive Information​
Type | Field | Masked Value |
---|---|---|
Request Body | account | ***** |
Request Body | phone | 010-- |
These values will be masked automatically in the logged request/response body output.