DataPower API Gateway
only

Log

Use the Log policy to customize or override the default activity logging configuration for an API.

Gateway support

Table 1. Table showing which gateways support this policy, and the corresponding policy version
Gateway Policy version
DataPower® API Gateway, policy available from V2018.4.1.7 2.0.0

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

About

By default, the logging of activity when an API is called, and the sending of the log data to the analytics server, is determined by the settings in the API definition, as described in Activity logging with the DataPower API Gateway. However, you can customize activity logging by adding a Log policy to the API assembly flow.

The Log policy enables you to gather all API analytics data for processing in your assembly, and to control what activity log data is sent to the analytics server. Here are some examples of the ways in which you can use the Log policy to customize API activity logging:
  • Gather activity log data, use a Redaction policy to redact sensitive fields in the data, then send to the analytics server.
  • Send different levels of analytics data depending on certain conditions; for example, the API operation that was called.
  • Configure custom activity logging in a global policy that is applied to every API in a Catalog. For more information on global policies, see Working with global policies.

Properties

The following table lists the policy properties, indicates whether a property is required, specifies the valid and default values for input, and specifies the data type of the values.

Table 2. Log policy properties
Property label Required Description Data type
Title No The title of the policy.

The default value is log.

string
Description No A description of the policy. string
Mode Yes Select one of the following options:
  • Gather-only: gather all analytics data and write it to the log context variable, which populates the API event record on completion of the API execution. For more information on the fields in the log context variable, and the consequent API event record, see API event record fields.
  • Send-only: perform the following actions:
    • Read the data from the log context variable.
    • Truncate all message payloads and convert to a textual representation.
    • Send the data to the analytics server.
  • Gather-and-send: perform a gather-only operation, immediately followed by a send-only operation.

If you use the Send-only or Gather-and-send option, data is buffered and sent to the analytics server in batches according to the time interval configured for the Analytics Endpoint on the DataPower API Gateway. For more information, see Configuring an analytics endpoint in the DataPower knowledge center.

Note: If you are offloading to a third party analytics server, you can redact any aspect of the event data. If you are using API Connect analytics, you can redact only request and response payloads.
string