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 2.0.0

2.1.0 (DataPower API Gateway Version 10.0.3.0 or later)

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 Log.

About

The log policy has the following format:
- log:
  version: version
  title: title
  description: description
  mode: activity_logging_actions
  log-level: type_of_content_to_log

Properties

The following table describes the properties of the log policy.
Table 2. log policy properties
Property Required Description Data type
version Yes The policy version number string
title No A title for the policy. string
description No A policy description. string
mode Yes Specify one of the following values:
  • 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 field reference.
  • 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
log-level No The type of content to log. Specify one of the following values:
  • none: Indicates no logging.
  • activity; Logs the invocation only, which is only the resource URI.
  • header: Logs activity and header.
  • payload:Logs activity, header, and payload.
  • default; Use the log level setting defined in the API definition; for more information, see activity-log. This is the default value.
  • $(value): An inline parameter in the format $(value) to retrieve a value from the API context.
string

Example

- log:
  version: 2.0.0
  title: Gather activity log data for processing
  mode: gather-only