DEBUG
Configuring Message Logging for Flex Gateway in Connected Mode
Applying a Message Logging policy to your API instance in API Manager allows you to view basic logs, such as inbound and outbound calls and headers, for APIs managed by Flex Gateway within API Manager. Logging for an API instance only happens if you configure and apply a Message Logging policy.
To view metrics in API Manager, such as total requests, total policy violations, total errors, and average response time, see Viewing Key Metrics for Flex Gateway APIs.
Message Logging Limits and Features
API Manager stores up to 100 MB of logs per API instance for 30 days. Runtime Manager automatically purges logs that go beyond 100 MB per API instance. If you need more storage, you can either use a third-party service (configured through a policy) or sign up for a Titanium subscription.
For each API instance configured through a policy, basic logs report the following:
-
Inbound and outbound API calls, as well as the packet contents
-
Headers and any other information in the request
To view message logs in API Manager, you need one of the following permissions:
-
API Manager Environment Administrator
-
API Manager Deploy API Proxies
-
General Organization Administration
Before You Begin
Before configuring message logging for a Flex Gateway, complete the following tasks:
Configure Message Logging in Connected Mode
-
From API Administration in API Manager, select the name of the API Instance.
-
Click Policies.
-
Click + Add policy.
-
Under the Troubleshooting category, click Message Logging.
-
Click Next.
-
Click + Add.
-
Enter a Configuration Name, for example, Info messages before calling API.
-
Enter a DataWeave expression that selects what information you want to see.
For example,
#[attributes.header['id']]
extracts the ids from the headers of the messages. For more information, see DataWeave Support in Flex Gateway Policies. -
If you want to filter log messages, enter a DataWeave expression.
For example,
#[attributes.headers['id']==1]
displays log messages that have an id of 1 in the header. -
If you want to affix a prefix to your logs, enter a Category.
-
Enter the severity level.
You can only enter one level. See Message Logging Severity Levels for a description of each severity level and the hierarchy for the levels.
-
If you want messages after the API is called, select After Calling API.
-
If you want to add additional configurations, click + Add.
-
Click Save.
Afterward, you should see a Message Log option for the API instance.
Use the search field to search for specific logs based on the time and log severity (INFO, ERROR, WARN, DEBUG). You can download these logs for further analysis.
Message Logging Severity Levels
When you configure a Message Logging policy for your API instance, you can assign a severity level. Each severity level includes a specific set of information in the log report.
Log reports include the severity level you select and the following levels on the hierarchy.
For example, if you select DEBUG, the log reports include the DEBUG severity level as well as the INFO, WARN, and ERROR severity levels. However, if you select ERROR, the log reports include only error messages. The following table describes the type of information included in the logs for each severity level:
Log Severity Level | Description |
---|---|
Tracing information used by application developers. |
|
INFO |
Informational messages that highlight the progress of the application. |
WARN |
Potentially harmful situations that indicate potential problems. |
ERROR |
Events that prevent normal program execution but might allow the application to continue running. |