Activity log policy
Configure the activity log policy to manage the level of detail of the data stored in API events.
When you configure an API in the API
Manager UI, you choose what data is
stored in the API event records for calls to that API with the
activity log
property. The activity log
property has separate settings for successful API calls,
and for failed API calls. The activity log options are: Note:
If your gateway is configured to authenticate all API calls with an OAuth provider, the data that is related to the OAuth call is only included in the API event data when the OAuth call fails. Successful OAuth authentication is not recorded in the API event data.
Important: The maximum API event record size is 19 Mb. The analytics
subsystem rejects any API event records that are larger than 19 Mb.
Defining log setting in the API Manager UI
- In the API Manager UI Develop view, select the API that you want to work with. If you are not familiar with the API Manager UI Develop view, see Working with API definitions.
- Select the Gateway tab, expand Gateway and portal settings, then select Activity Log.
- Select Enabled, then select the preferred log setting for
Success Content and Error Content:
- Click Save to save your changes.
Defining log setting in source for DataPower® API Gateway
Use the activity-log
extension to configure your logging preferences.
activity-log:
success-content: <success log setting: none, activity, header, payload>
error-content: <failure log setting: none, activity, header, payload>
enabled: <if activity logging is enabled: true or false>
Note: If payload logging is enabled, for the gateway to
capture payloads buffering must also be enabled.
Examples:activity-log:
success-content: <success log setting: none, activity, header, payload>
error-content: <failure log setting: none, activity, header, payload>
enabled: <if activity logging is enabled: true or false>
buffering: true
- No logging of successful calls, header logging for failed calls
-
activity-log: success-content: none error-content: header enabled: true
- Disable activity logging
-
activity-log: enabled: false
Defining log setting in source for DataPower Gateway (v5 compatible)
The activity-log policy has
the following format:
- activity-log:
version: <version>
title: <title>
description: <description>
content: <success log setting: none, activity, header, payload>
error-content: <failure log setting: none, activity, header, payload>
where:- <version> is the policy version number. Set version to 1.0.0.
- <title> is a title for the policy.
- <description> is a description for the policy.
Apply this policy by adding an assembly extension with an execute field to your OpenAPI definition file.
Note: If payload logging is enabled, for the gateway to
capture payloads buffering must also be enabled.
activity-log:
success-content: activity_to_log_if_call_successful
error-content: activity_to_log_if_call_unsuccessful
enabled: is_activity_logging_enabled
buffering: true
Examples:
- Maintain default log behavior
- Do not specify
content
orerror-content
:- activity-log: version: 1.0.0 title: default activity logging
- No logging of successful calls, activity logging for failed calls
-
- activity-log: version: 1.0.0 title: no logging for successful calls content: none error-content: activity