The parameters of the Apitally SDK for Go.
The following are the fields of the Config
struct.
Parameter | Description | Type |
---|---|---|
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 |
RequestLogging | Configuration options for request logging. See table below. | *RequestLoggingConfig |
AppVersion | The current version of your application, e.g. 1.0.0 . | string |
The following are the fields of the RequestLoggingConfig
struct.
Parameter | Description | Type | Default |
---|---|---|---|
Enabled | Whether request logging is enabled. | bool | false |
LogQueryParams | Whether to include query parameters in the logs. If disabled, these will be stripped from the request URLs logged. | bool | true |
LogRequestHeaders | Whether to include request headers in the logs. Default masking for common sensitive headers (e.g. Authorization ) applies. | bool | false |
LogRequestBody | Whether to include the request body in the logs. Only JSON and text are supported, up to 50 KB. | bool | false |
LogResponseHeaders | Whether to include response headers in the logs. | bool | true |
LogResponseBody | Whether to include the response body in the logs. Only JSON and text are supported, up to 50 KB. | bool | false |
LogPanic | Whether to log information when a panic occurs during request handling. | bool | false |
MaskQueryParams | List of regular expressions for matching query parameters to mask. These are in addition to the default masking patterns. | []*regexp.Regexp | nil |
MaskHeaders | List of regular expressions for matching headers to mask. These are in addition to the default masking patterns. | []*regexp.Regexp | nil |
MaskBodyFields | List of regular expressions for matching request/response body fields to mask. These are in addition to the default masking patterns. | []*regexp.Regexp | nil |
MaskRequestBodyCallback | Callback function for masking the request body. Takes one parameter request and returns the request body as []byte or nil . | func(request *Request) []byte | nil |
MaskResponseBodyCallback | Callback function for masking the response body. Takes two parameters request and response and returns the response body as []byte or nil . | func(request *Request, response *Response) []byte | nil |
ExcludePaths | List of regular expressions for matching paths to exclude from logging. | []*regexp.Regexp | nil |
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. | func(request *Request, response *Response) bool | nil |
Below are the fields of the Request
struct.
Field | Description | Type |
---|---|---|
Timestamp | Unix timestamp of the request. | float64 |
Method | HTTP method of the request. | string |
Path | Path of the request. | string |
URL | Full URL of the request. | string |
Headers | Array of key-value pairs representing the request headers. | [][2]string |
Size | Size of the request body in bytes. | int64 |
Consumer | Identifier of the consumer making the request. | string |
Body | Raw request body. | []byte |
Below are the fields of the Response
struct.
Field | Description | Type |
---|---|---|
StatusCode | HTTP status code of the response. | int |
ResponseTime | Time taken to respond to the request in seconds. | float64 |
Headers | Array of key-value pairs representing the response headers. | [][2]string |
Size | Size of the response body in bytes. | int64 |
Body | Raw response body. | []byte |
The below regular expressions are used to mask sensitive query parameters, headers and request/response body fields.
The below regular expressions are used to exclude common health check endpoints from logging. They are applied to the request path.
The parameters of the Apitally SDK for Go.
The following are the fields of the Config
struct.
Parameter | Description | Type |
---|---|---|
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 |
RequestLogging | Configuration options for request logging. See table below. | *RequestLoggingConfig |
AppVersion | The current version of your application, e.g. 1.0.0 . | string |
The following are the fields of the RequestLoggingConfig
struct.
Parameter | Description | Type | Default |
---|---|---|---|
Enabled | Whether request logging is enabled. | bool | false |
LogQueryParams | Whether to include query parameters in the logs. If disabled, these will be stripped from the request URLs logged. | bool | true |
LogRequestHeaders | Whether to include request headers in the logs. Default masking for common sensitive headers (e.g. Authorization ) applies. | bool | false |
LogRequestBody | Whether to include the request body in the logs. Only JSON and text are supported, up to 50 KB. | bool | false |
LogResponseHeaders | Whether to include response headers in the logs. | bool | true |
LogResponseBody | Whether to include the response body in the logs. Only JSON and text are supported, up to 50 KB. | bool | false |
LogPanic | Whether to log information when a panic occurs during request handling. | bool | false |
MaskQueryParams | List of regular expressions for matching query parameters to mask. These are in addition to the default masking patterns. | []*regexp.Regexp | nil |
MaskHeaders | List of regular expressions for matching headers to mask. These are in addition to the default masking patterns. | []*regexp.Regexp | nil |
MaskBodyFields | List of regular expressions for matching request/response body fields to mask. These are in addition to the default masking patterns. | []*regexp.Regexp | nil |
MaskRequestBodyCallback | Callback function for masking the request body. Takes one parameter request and returns the request body as []byte or nil . | func(request *Request) []byte | nil |
MaskResponseBodyCallback | Callback function for masking the response body. Takes two parameters request and response and returns the response body as []byte or nil . | func(request *Request, response *Response) []byte | nil |
ExcludePaths | List of regular expressions for matching paths to exclude from logging. | []*regexp.Regexp | nil |
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. | func(request *Request, response *Response) bool | nil |
Below are the fields of the Request
struct.
Field | Description | Type |
---|---|---|
Timestamp | Unix timestamp of the request. | float64 |
Method | HTTP method of the request. | string |
Path | Path of the request. | string |
URL | Full URL of the request. | string |
Headers | Array of key-value pairs representing the request headers. | [][2]string |
Size | Size of the request body in bytes. | int64 |
Consumer | Identifier of the consumer making the request. | string |
Body | Raw request body. | []byte |
Below are the fields of the Response
struct.
Field | Description | Type |
---|---|---|
StatusCode | HTTP status code of the response. | int |
ResponseTime | Time taken to respond to the request in seconds. | float64 |
Headers | Array of key-value pairs representing the response headers. | [][2]string |
Size | Size of the response body in bytes. | int64 |
Body | Raw response body. | []byte |
The below regular expressions are used to mask sensitive query parameters, headers and request/response body fields.
The below regular expressions are used to exclude common health check endpoints from logging. They are applied to the request path.