activity-log

Use the Activity Log policy to configure your logging preferences for the API activity that is stored in IBM® API Connect analytics. The preferences that you specify will override the default settings for collecting and storing details of the API activity.

Gateway support

Table 1. Table showing which gateways support this policy, and the corresponding policy version
Gateway Policy version
DataPower® Gateway (v5 compatible) 1.0.0

This topic describes how to configure the policy in your OpenAPI source; for details on how to configure the policy in the assembly user interface, see Activity Log.

Note: If you are using the DataPower API Gateway, you configure your logging preferences by using the activity-log extension.

About

The activity-log policy has the following format:
- activity-log:
  version: version
  title: title
  description: description
  content: activity_to_log_if_call_successful
  error-content: activity_to_log_if_call_unsuccessful

Apply this policy by adding an assembly extension with an execute field to your OpenAPI definition file.

You can also apply an activity-log policy by using the API Designer assembly editor to add a built-in policy to the API. For more information, see Activity Log in the built-in policies section.

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

Properties

The following table describes the policy properties:
Table 2. Activity Log policy properties
Property Required Description Data type
version Yes The policy version number string
title Yes A title for the policy. string
description No A description of the policy. 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
error-content No Indicates what content to log if 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 1

# use defaults

- activity-log:
  version: 1.0.0
  title: default activity logging

Example 2

- activity-log:
  version: 1.0.0
  title: no logging for successful calls
  content: none
  error-content: activity