Core Concepts
1. Threshold Evaluation Mode
This mode is suitable for scenarios requiring threshold comparison on aggregated values.Configuration
- Query Statement: Write SLS SQL aggregate query.
- Example: Count error log quantity by host in the last 15 minutes.
- Query Parameters:
sls.project: (Required) Project name.sls.logstore: (Required) Logstore name.sls.timespan.value: (Optional) Time span value, default is 15.sls.timespan.unit: (Optional) Time span unit, supportss(seconds),m(minutes),h(hours),d(days). Default ism.
- Field Mapping:
- Value fields: Select
error_cntfor threshold evaluation. - Label fields: Select
hostto identify the alert object. After you select label fields, other non-value fields are carried with the alert as additional information. - See Query Result Field Mapping for the complete behavior.
- Threshold Conditions:
- Use
$A.field_nameto reference values. - Example:
Critical: $A.error_cnt > 50,Warning: $A.error_cnt > 10.
How It Works
Monitors runs the SLS query for the configured time range, distinguishes alert objects by their label fields, and evaluates thresholds with their value fields. If Label fields is empty, every returned field except the value fields becomes a label.Recovery Logic
2. Data Exists Mode
This mode is suitable for scenarios where filter logic is written directly in SQL.Configuration
- Query Statement: Use
HAVINGclause to filter anomalous data.
- Example: Query hosts with error count exceeding 50.
- Query Parameters: Same as above, need to configure
sls.projectandsls.logstore. - Evaluation Rules: As long as query returns data, triggers alert.
Pros and Cons Analysis
Recovery Logic
- Recovery When Data Disappears: When query result is empty, determines recovery
- Recovery Query: Supports configuring additional query statements
- Manual Close: Keep the alert active until it is closed manually
3. No Data Mode
This mode is used to monitor scenarios where “data is expected but actually missing”.Configuration
- Query Statement: Write a query that is expected to continuously return data.
- Example: Query log reporting heartbeat from all hosts.
- Evaluation Rules: If a
hostappeared in previous cycles but cannot be found in current and N consecutive cycles, triggers “No Data” alert.
Recovery Logic
No-data alerts support configuring the alert ending mode, which decides how the alert ends:4. Advanced Configuration
Power SQL
Power SQL
If you need to use SLS enhanced SQL syntax, add in query parameters:
sls.powersql: trueTime Range Control
Time Range Control
Default queries data from the last 15 minutes. Adjustable via parameters:
Maximum returned rows
Maximum returned rows
In raw log search mode,
sls.lines controls the maximum number of log rows returned by a single query. Each returned row can produce one alert.Applies to raw log search only. Aliyun ignores this setting when the query contains SQL.
Debug Parameters
Debug Parameters
For debugging only; do not configure in production rules: