You can enable transaction logging for API to record and view the activities of your API.
This record keeps a track of when an event occurred, why it occurred and what was impacted. The
audit logs provide a detailed record of various auditable events of an API such as user login and
logout details and the user responsible for it. By logging the transactions of the API, you can
learn more about API activities, which might be useful for troubleshooting if something goes wrong.
Before you begin
Make sure that the API you are working with is created and enforced with the necessary
policies.
About this task
webMethods API Gateway can log transactions and capture data of various auditable events of APIs. By
default, webMethods API Gateway does not log the transactions. Enable transaction logging so that the log data
for the API to view the analytics of the API and detect anomalies. The following section describes
how to activate the online_petstore API in webMethods API Gateway, enable transaction
logging of the API, and view the logs and analytics at the API level.
Procedure
- Make sure the online_petstore API is activated.
Before you enable the audit API, you must first activate it so that the users can access the
gateway localhost and use the API. If the API is not in an active state, perform the following
steps.
- Log on to your webMethods API Gateway instance.
- Open the menu options and selectAPIs.
- Select online_petsore API from the list of APIs and set Activate to on to
activate the API.
- Enable transaction logging API
- Click online_petstore > Policies.
- Expand the traffic monitoring tab.
- Click Log Invocation.
- Select the necessary Log Invocation policy properties in the
right window and select webMethods API Gateway as the
destination.
- Click Save. If you want to apply the transaction logging
changes to all the APIs, you can use a Global policy.
- View the analytics data
- Go to the Postman.
- Set the request method to GET and type the URL-
http://host:port/gateway/online_petstore/1.0.6
- Click Send to call the endpoint.
- On the webMethods API Gateway instance,
Open the menu options and click
APIs.
- Select online_petstore API > API Analytics. This function
displays the API-specific transaction data.
The chart specifies the number of events generated at a specific time. The analytics data remains
the same regardless of whether the properties of payload log invocation are selected or not.
The headers and the payload log data are saved when the payload properties are enabled. In this
case, the size of the data increases drastically. If the payload properties are disabled, then only
the headers are saved. The size of the data is minimal.
You can sort the data by selecting the necessary options in the filter.