You can use the log analysis feature to accurately identify business exceptions on your application based on business logs. This topic describes how to enable and use the log analysis feature.
Prerequisites
- The ARMS agent is v2.7.1.3 or later. Log on to the ARMS console. In the left-side navigation pane, choose . Click the Java Release Notes tab to obtain the agent installation package of v2.7.1.3.
- The log analysis feature only can analyze the logs of applications in Container Service for Kubernetes (ACK) clusters. In addition, applications in ACK clusters must be connected to the application monitoring feature in annotation mode. For more information about how to use annotations to connect an application to the application monitoring feature, see Install the ARMS agent for Java applications deployed in ACK.
How log collection works

- After you enable the log collection feature, the collected business logs are saved to your computer.
- After the log collection agent is installed, the log collection agent reads local
business logs and sends them to the ARMS console.
Note You can install the log collection agent only once for an ACK cluster.
- On the Log Analysis page of the ARMS console, you can query, filter, and analyze business logs by keyword. For example, you can filter exception log by keywords such as order ID, trace ID, and application name.
Step 1: Enable the log collection feature
- Log on to the ARMS console.
- In the left-side navigation pane, Select .
- In the top navigation bar of the MNS console, select the region where your cluster is deployed.
- Log on to the Applications Page, click the application name.
- In the left-side navigation pane, click Application Settings. On the page that appears, click the Custom Configuration tab.
- In the Log Analysis Settings section of the Custom Configuration tab, turn on the Automatic Log Collection switch, select the log severity, and set the maximum size of a single log.
- On the Custom Configuration tab, click Save in the lower-left corner.
(Optional) Step 2: Install the log collection agent
You can install the log collection agent only once for an ACK cluster. Perform the following steps to check whether the log collection agent is installed in the ACK cluster where the current application resides.
Query logs
Basic query

The base query supports the following filter operations:
- In the upper-right corner of the Basic Query page (①), set the time range for logs.
- Click the arms_app drop-down list (②) to select other applications that have the log collection feature enabled.
- Enter a keyword in the search box (③). Press Enter or click search to search for logs that contain the keyword. For example, if you enter WARN, you can view all Warn-level logs.
Note Keywords are case-sensitive.
Advanced query
Click Advanced Query in the upper-right corner of the Log Analysis page. On the Advanced Query page, you can query logs by LogQL statements.

The advanced query supports the following filter operations:
- In the upper-right corner of the Advanced Query page (①), set the time range for logs.
- Enter a LogQL statement in the field (②) and click Run Query in the upper-right corner to filter business logs.
LogQL statements allow you to filter logs by log labels and keywords. LogQL statements must contain log labels.
- Log labels are in the following format: {Label key-value pair}. You can also click
the Log labels drop-down list and select a key-value pair.
The following operators are supported for label key-value pairs:
=
: equal to!=
: not equal to=~
: regular expression match!~
: regular expression mismatch
- Keywords: You can add a keyword after the log label to further filter business logs.
The following operators are supported for keywords:
|=
: contain!=
: not contain|~
: regular expression match!~
: regular expression mismatch
Note Keywords are case-sensitive.
- Log labels are in the following format: {Label key-value pair}. You can also click
the Log labels drop-down list and select a key-value pair.
View logs
In the business log list section, you can perform the following operations:
View log details
Click the row for a log entry to view the labels and keywords contained in the log entry.

In the Log Labels section, you can perform the following operations:
- Click the
icon before a label to filter the logs that contain the current label key-value pair.
- Click the
icon before a label to filter the logs that do not contain the current label key-value pair.
- Click the console link next to Trace ID to view the trace information and business information.
View log context
To view the context of a log entry, move the pointer over the row for the log entry and click Show context.
By default, five log entries are displayed before and after each selected log entry. To view more, click Load 10 more in the upper and lower sections.
