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

Counting Log Keywords

Scenario

When an application is normal, its log file contains fewer than 10 error keywords every 10 minutes. However, when the application becomes abnormal, the number of error keywords increases rapidly. To identify an exception in a timely manner, you can use AOM to count the number of errors in logs and set threshold rules.

Procedure

  1. Log in to the AOM console. In the navigation pane, choose Log > Statistical Rules and click Create Statistical Rule.
  2. Create a statistical rule for the log bucket and set the keyword error.

  3. Create a threshold rule for the statistical rule and set the trigger condition as follows: if the number of errors is greater than 12 within 5 minutes, an alarm will be reported.

  4. After the threshold rule is created, if the statistical result exceeds the threshold, a Short Message Service (SMS) message or email will be sent immediately, informing you that the threshold has been exceeded and your service may be abnormal. The fault can then be located and rectified at the earliest time.