Configuring activity logging

You can configure your logging preferences for the API activity that is stored in analytics, overriding the default activity logging behavior.

About this task

Note: This task relates to configuring an OpenAPI 2.0 API definition. For details on how to configure an OpenAPI 3.0 API definition, see Editing an OpenAPI 3.0 API definition.

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

An API event record exists for each API execution event in the Gateway server. By default, the content type for a successful API execution is activity, and payload for an API call the results in 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.

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.

At any time, you can switch directly to the underlying OpenAPI YAML source by clicking the Source icon OpenAPI Source icon. To return to the design form, click the Form icon Form icon.

Procedure

  1. Open the API for editing, as described in Editing an OpenAPI 2.0 API definition.
  2. Select the Gateway tab, expand Gateway and portal settings, then click Activity Log.
  3. Select Enabled, then select options for the Success Content and Error Content fields as follows:
    Field label Description
    Success Content Defines the type of content to be logged when the operation is successful.
    • 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; the HTTP headers, in addition to the resource URI are recorded.
    • payload: Logs activity, header, and payload; all information, including the payload that is received in a request or returned in a response, is recorded.

    The default value is activity.

    Error Content Indicates what content to log when an error occurs.
    • 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; the HTTP headers, in addition to the resource URI are recorded.
    • payload: Logs activity, header, and payload; all information, including the payload that is received in a request or returned in a response, is recorded.

    The default value is payload.

    Preserved request header Click Add to specify customized request headers to preserve for logging to analytics.
    Preserved response header Click Add to specify customized response headers to preserve for logging to analytics.
  4. Click Save to save your changes.