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 Application Operations Management (AOM) to count the number of errors in logs and set threshold alarms.

Procedure

  1. Create a log bucket and store log files of the target application to the bucket.

  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. Then, locate and rectify the fault as soon as possible.