You can enable logging for entry and exit trace and for large payloads
for apim-v2 pods.
About this task
For apim-v2 pods, the default logging settings do not include entry and exit trace and logging of
large payloads.
Logging of large payloads is typically needed if you are logging
apim:webhookPayload
or other processes that log large variables.
You can also set the debug level without needing to restart the pods.
You can enable the settings through either the APIM deployment YAML file, the toolkit, or the
REST APIs. Note, you must use the toolkit or REST API to set the debug level without restarting the
pods.
Procedure
- Updating the settings in the APIM deployment YAML file
Note: This action causes a pod restart.
- The DEBUG variable works the same as prior
releases.
- env:
- name: DEBUG
value: audit,bhendi:error,bhendi:probe,bhendi:flags,apim:server,apim:error,apim:routes:*,apim:routesc:*,apim:oidc,apim:oidc:*
To
enable entry and exit trace, add trace:*
to the start of the debug
string:
- env:
- name: DEBUG
value: trace:*,audit,bhendi:error,bhendi:probe,bhendi:flags,bhendi:webhookAudit,bhendi:cassandra-transactions,apim:server,apim:error,apim:routes:*,apim:routesc:*,apim:oidc,apim:oidc:*,apim:taskmanager:info
- To enable large object
logging:
- env:
- name: VELOX_LOG_FULL_PAYLOAD
value: "true"
- Updating the settings by using the toolkit
Note: This action does not cause a pod restart. Also, this action is for a single APIM pod
environment only.
apic log-spec:get
apic log-spec:update LOG_SPEC_FILE
Where the spec file contains:
{"specification": "apim:routes:log_spec,audit,bhendi:error,apim:server,apim:error", "large_objects": true}
- Updating the settings by using the REST API
Note: This action does not cause a pod restart. Also, this action is for a single APIM pod
environment only.
GET /cloud/api/log-spec
PUT /cloud/api/log-spec
For example, to set debug level and large objects logging:
curl -k https://172.16.140.212:3003/api/cloud/log-spec -X PUT -H "Authorization: Bearer $BEARER"
-H "Accept: application/json" -d '{"specification": "apim:routes:log_spec,audit,bhendi:error,apim:server,apim:error","large_objects": true}'
-H "Content-Type: application/json"
The command responds with:
{
"specification": "apim:routes:log_spec,audit,bhendi:error,apim:server,apim:error",
"large_objects": true,
"message": "Successfully changed the log specification on all apim-v2 pods. Success on IP(s): 172.16.140.212, 172.16.140.213"
}
Note: The response might include the following warning, which can be
ignored:
WARNING: Could not change the log specification on all apim-v2 pods. Success on IP(s): 4.5.6.7 Failed on IP(s): 1.2.3.4
To view the REST APIs for logging, go to API Connect REST APIs,
and select .