Updated on 2023-12-01 GMT+08:00

Creating a Metric Filter

This section describes how you can create a metric filter. The metric will be monitored in AOM. If you set an alarm for the metric, you will be alerted when the number of occurrences of the metric reaches the configured threshold. Up to 5 metric filters can be created in each log stream.

  1. Log in to the console.
  2. Choose Service List > Management & Deployment > Log Tank Service.

    Choose Log Management.

  3. In the log group list, click the name of the log group where the target log is located.

    The log stream list is displayed.

  4. Click Metric Filter.
  5. Configure metric filter parameters by referring to Table 1 and click OK.
Table 1 Metric filter parameters

Parameter

Description

Filter Name

Filter names are used to distinguish different filters in a log stream. A name cannot start with a period (.) or underscore (_) or end with a period. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed.

Filtering Keyword

A filter counts the number of occurrences for the specified keyword in the log stream.

Only filtering with a single keyword, such as Error and Warning, is supported. If you enter multiple keywords, such as Fail to root, they are considered as a whole. Filtering is case-sensitive and looks for exact matches. Numbers and special characters must be enclosed by double quotation marks.

Example Log

Example logs are used to test whether the filtering can match logs based on the configured keyword. When you click To Paste, you will be directed to the Raw Logs tab. You can search for logs containing the keyword and paste them to the test box to check whether the filtering works. You can also modify the keyword.

Metric Name

A metric name maps to a filtering keyword and resembles a key in a key-value pair. LTS carries out metric statistics and releases the results to AOM so you can monitor the frequency of the keyword, set thresholds, and receive alarms when the frequency exceeds the threshold. A metric name can contain 1 to 64 characters and must start with a letter. Only letters, digits, and underscores (_) are allowed. Metric names in a same log stream must be unique. Otherwise, data may be inaccurate.