Log
This policy enables logging requests or responses to a specified destination.
The Log action also logs other information about the requests or responses. You can configure information like API name, operation name, the Integration Server user, a timestamp, and the response time.
In IBM API Studio, this policy is identified by
the kind Log.
Example of a Log Invocation policy in code view.
kind: Log
apiVersion: api.ibm.com\v1
metadata:
name: log_invocation
version: 1.0
namespace: sample
tags:
- log_invocation
spec:
logRequestHeaders: true # default value is false
logResponseHeaders: true # default value is false
logRequestPayload: true # default value is false
logResponsePayload: true # default value is false
compressPayloads: true # default value is false
logGenerationFrequency: always #Other values are 'onfailure' & 'onsuccess'
destination:
- api_gateway
- dev_portals
- email:
- nas@email.com
- daso@email.com
- snmp
- jdbc
- centraSite
- elasticsearch
- log-file:
level: info
- auditLog
- apic
For the Log policy kind, configure these specifications:
| Code view | Form view | Description |
|---|---|---|
logRequestHeaders |
Store request headers |
Specifies that the request headers are to be logged. In the code view, set the value to In the form view, select the box to set it to |
logRequestPayload |
Store request payload |
Specifies that the response headers are to be logged. In the code view, set the value to In the form view, select the box to set it to |
logResponseHeaders |
Store response headers |
Specifies that the request payload is to be logged. In the code view, set the value to In the form view, select the box to set it to |
logResponsePayload |
Store response payload |
Specifies that the response payload is to be logged. In the code view, set the value to In the form view, select the box to set it to |
compressPayloads |
Compress payload |
Specifies that the payload is to be compressed. In the code view, set the value to In the form view, select the box to set it to |
logGenerationFrequency |
Log generation frequency |
Specifies how frequently to log the payload. You can choose one of the following options:
|
destination |
Destination |
Specifies the destination to log the payload. You can specify one of these destinations:
|