Activity logging with the DataPower API Gateway

If you’re using the DataPower® API Gateway, you can use the Activity Log tab in the API Manager UI to configure your logging preferences for the API activity that is stored in Analytics. The preferences that you specify will override the default settings for collecting and storing details of the API activity.

You can complete this task either by using either the API Designer UI application, or by using the browser based API Manager UI.

About

An API event record exists for each API execution event in the Gateway server. By default, the content type that is collected and stored in API event records is activity for when API execution completes successfully, and payload for when API execution completes with an error code. When you compose your API definition, you can change the type of content to log in these API event records. During API execution, the activity data is stored in the log context variable, which populates the API event record on completion of the API execution; for more information, see API activity logging context variables.

Activity logging can be configured in the API Manager by using the Activity Log tab, in the Design view of the Develop API editor. Or you can edit the source directly (see the Example source section for details).

Note that if you're using the DataPower Gateway (v5 compatible), you can configure your logging preferences by applying an Activity Log policy in the Assemble view. For more information, see Activity Log.

Note:

Activity logging that calls for logging of Analytics data upon success doesn't apply for the OAuth provider. The OAuth provider logs Analytics data for failure cases, but doesn't log successful cases.

Properties

The following table lists the activity log properties in the API Manager UI, indicates whether a property is required, specifies the valid and default values for input, and specifies the data type of the values.

Table 1. Activity log properties
Property label Required Description Data type
Activity Log Yes Indicates whether activity logging is enabled or disabled.

Use the slider control to turn activity logging On or Off. The default value is On.

string
Content Yes Defines the type of content to be logged when the operation is successful.
Valid values:
  • none: Indicates that no logging occurs.
    Restriction: This option disables notifications for application developers who use your Developer Portal.
  • activity: Logs invocation only (only the resource URI is recorded).
  • header: Logs activity and header.
  • payload: Logs activity, header, and payload (the original request, if any, and the final response).

The default value is activity.

string
Content on error Yes Indicates what content to log when an error occurs.
Valid values:
  • none: Indicates that no logging occurs.
    Restriction: This option disables notifications for application developers who use your Developer Portal.
  • activity: Logs invocation only (only the resource URI is recorded).
  • header: Logs activity and header.
  • payload: Logs activity, header, and payload (the original request, if any, and the final response).

The default value is payload.

string

Example source

The following examples show how the OpenAPI for the activity log configuration looks in the source code.

Example one shows the default activity log preferences:
activity-log:
    success-content: activity
    error-content: payload
    enabled: true
Example two shows activity logging that has been turned off:
activity-log:
    enabled: false