Configuration
You can configure Apitally via a configuration object.Parameters
The following configuration parameters are available. OnlyclientId and env are required.
| Parameter | Description | Type | Default |
|---|---|---|---|
clientId | Client ID for your application. Find it on the Setup instructions page for your app. | string | |
env | Name of the environment, e.g. prod or dev. The environment will be automatically created if it doesn’t exist. | string | dev |
requestLogging | Configuration options for request logging. See table below. | object | |
appVersion | The current version of your application, e.g. 1.0.0. | string | |
logger | A custom logger instance. If not provided, a default logger is created automatically. | object |
requestLogging parameter is an object with the following properties:
| Parameter | Description | Type | Default |
|---|---|---|---|
enabled | Whether request logging is enabled. | boolean | false |
logQueryParams | Whether to include query parameters in the logs. If disabled, these will be stripped from the request URLs logged. | boolean | true |
logRequestHeaders | Whether to include request headers in the logs. Default masking for common sensitive headers (e.g. Authorization) applies. | boolean | false |
logRequestBody | Whether to include the request body in the logs. Only JSON and text are supported, up to 50 KB. | boolean | false |
logResponseHeaders | Whether to include response headers in the logs. | boolean | true |
logResponseBody | Whether to include the response body in the logs. Only JSON and text are supported, up to 50 KB. | boolean | false |
logException | Whether to include exception details in the logs. | boolean | true |
captureLogs | Whether to capture application logs emitted during request handling. | boolean | false |
captureTraces | Whether to enable tracing with OpenTelemetry. | boolean | false |
maskQueryParams | Array of regular expressions for matching query parameters to mask. These are in addition to the default masking patterns. | RegExp[] | [] |
maskHeaders | Array of regular expressions for matching headers to mask. These are in addition to the default masking patterns. | RegExp[] | [] |
maskBodyFields | Array of regular expressions for matching request/response body fields to mask. These are in addition to the default masking patterns. | RegExp[] | [] |
maskRequestBodyCallback | Callback function for masking the request body. Takes one parameter request and returns the request body as Buffer or null. | Function | - |
maskResponseBodyCallback | Callback function for masking the response body. Takes two parameters request and response and returns the response body as Buffer or null. | Function | - |
excludePaths | Array of regular expressions for matching paths to exclude from logging. | RegExp[] | [] |
excludeCallback | Callback function for excluding requests from logging. Takes two parameters request and response and returns true, if the request should be excluded, or false otherwise. | Function | - |