Skip to content

Commit 66580db

Browse files
authored
Merge pull request #298 from flashcatcloud/doc-review/2026-08-21-220237
docs(monitors): align datasource docs with current code
2 parents d778ebc + 4d3c0c4 commit 66580db

8 files changed

Lines changed: 153 additions & 23 deletions

File tree

en/monitors/alert-rules/elasticsearch.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ Due to SQL feature dependency, only **ElasticSearch 6.3** and above versions are
1414
| Config Item | Description |
1515
|--------|------|
1616
| **Query Language** | Currently only supports SQL syntax |
17-
| **Field Processing** | All field names are automatically converted to lowercase; please use lowercase letters when configuring |
17+
| **Field Processing** | Preserves the column-name casing returned by Elasticsearch SQL. Use the actual returned column names when configuring label and value fields |
18+
19+
<Tip>
20+
Use explicit, stable column aliases in SQL and match their casing exactly in field mappings. This prevents mappings from breaking when query fields change.
21+
</Tip>
1822

1923
## 1. Threshold Evaluation Mode
2024

en/monitors/alert-rules/query-result-fields.mdx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: "Map SQL and raw log query results to value fields, label fields, a
44
keywords: ["query results", "value fields", "label fields", "additional information", "threshold expressions", "multiple queries"]
55
---
66

7-
Table-shaped queries for MySQL, PostgreSQL, Oracle, ClickHouse, Elasticsearch, and SLS, as well as **raw log** queries for Loki and VictoriaLogs, return rows with multiple fields. Use **Value fields** and **Label fields** to assign each field a purpose. Any remaining fields are automatically carried with the alert as additional information.
7+
Table-shaped queries for MySQL, PostgreSQL, Oracle, ClickHouse, Elasticsearch, SLS, and Tencent CLS, as well as **raw log** queries for Loki, VictoriaLogs, SLS, and Tencent CLS, return rows with multiple fields. Use **Value fields** and **Label fields** to assign each field a purpose. Any remaining fields are automatically carried with the alert as additional information.
88

99
<Warning>
1010
The complete field-mapping behavior described on this page requires monit-edge `v0.53.0` or later, especially the `$<query name>.<field name>` convention for query-provided additional information. Upgrade the alert engine to `v0.53.0` or later before using these settings.
@@ -69,6 +69,8 @@ Explicitly select label fields for raw log queries. Otherwise, timestamps and ra
6969

7070
The SLS-provided `__source__` and `__time__` fields do not automatically become labels when Label fields is empty. If you need either value, assign it an alias in the query and configure the alias as a regular field.
7171

72+
Tencent CLS raw logs can also contain `__cls_*` metadata fields. Monitors does not exclude these fields automatically. Explicitly select stable fields such as service, host, or Topic as labels, and leave log bodies, timestamps, and request-level identifiers as additional information.
73+
7274
## Referencing values in threshold expressions
7375

7476
The query name is the prefix of its threshold variables. For example, suppose query A has a value field named `error_count`.
@@ -140,12 +142,21 @@ The `$` prefix identifies query-provided fields. A custom field configured on th
140142
A No data alert carries the additional information from the last successful result for that alert object. If the query has never returned data, no query-provided additional information is available.
141143
</Note>
142144

143-
## Query result row limit
145+
## Query result row limits
146+
147+
Edge limits scheduled alert queries and interactive preview queries separately. The following defaults can be configured independently by the deployer:
148+
149+
| Scenario | Default limit | Edge parameter | Applies to |
150+
|----------|---------------|----------------|------------|
151+
| **Scheduled alert queries** | 1,000,000 rows | `--alerter.alertQueryMaxRows` | Main, recovery, and related queries |
152+
| **Data preview queries** | 1,000 rows | `--alerter.previewMaxRows` | Data source queries and rule editor previews |
153+
154+
A data source can impose a stricter limit. For example, raw log queries for SLS, Tencent CLS, Loki, and VictoriaLogs allow at most 100 configured rows. The effective limit is the lower of the scenario limit and the data-source-specific limit.
144155

145-
All alert rule queries have a hard limit of **1000 rows**, including the evaluation queries for Threshold, Data exists, and No data, as well as recovery queries and related queries. When a query returns more than 1000 rows, the query fails outright (error `too many rows`), this evaluation reports an error, and no alert is produced.
156+
When a query exceeds its effective limit, it fails with `too many rows`. Monitors does not return a partial result or evaluate alerts with truncated data.
146157

147158
<Warning>
148-
The limit applies to every data source type (MySQL, PostgreSQL, Oracle, ClickHouse, Elasticsearch, SLS, Loki, VictoriaLogs, Prometheus, etc.). High-cardinality Prometheus queries (more than 1000 series) or SQL queries returning large result sets will start failing and stop producing alerts.
159+
Increasing the Edge row limit does not disable safeguards for response bytes, field size, or total result values. High-cardinality Prometheus queries and large SQL results can still fail on another resource limit.
149160
</Warning>
150161

151162
Aggregate in the data source instead of letting a single rule query return many rows:
@@ -160,7 +171,7 @@ Each query result row can become one alert instance. Aggregating in the data sou
160171

161172
This page applies to:
162173

163-
- MySQL, PostgreSQL, Oracle, ClickHouse, Elasticsearch, and SLS queries
164-
- **Raw log** primary queries for Loki and VictoriaLogs
174+
- MySQL, PostgreSQL, Oracle, ClickHouse, Elasticsearch, SLS, and Tencent CLS queries
175+
- **Raw log** primary queries for Loki, VictoriaLogs, SLS, and Tencent CLS
165176

166177
The **aggregation** modes for Loki and VictoriaLogs return labeled time-series data directly and do not require manual field mapping.

en/monitors/alert-rules/tencent-cls.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Monitors retrieves data through the Tencent Cloud Log Service (CLS) search and a
2525
| `tencent_cls.syntax` | Search syntax: `CQL` / `Lucene`, used for raw log search | `cql` |
2626
| `tencent_cls.timespan.value` | Time span value | `15` |
2727
| `tencent_cls.timespan.unit` | Time span unit: `s` (seconds), `m` (minutes), `h` (hours), `d` (days) | `m` |
28-
| `tencent_cls.limit` | Maximum number of returned rows, raw mode only, 1-100 | `1` for new rules |
28+
| `tencent_cls.limit` | Maximum number of returned rows, raw mode only, 1-100 | `1` |
2929

3030
The region dropdown offers a list of commonly used regions (e.g., ap-guangzhou, ap-shanghai, ap-beijing); it is a suggestion, not a whitelist. You can also type any region code matching `[a-z0-9-]`; Tencent Cloud decides whether it works.
3131

@@ -36,7 +36,7 @@ The region dropdown offers a list of commonly used regions (e.g., ap-guangzhou,
3636
Searches logs with CQL or Lucene syntax and returns matching log lines. Each returned line can produce one alert.
3737

3838
- The time window is capped at **6 hours**.
39-
- `tencent_cls.limit` controls the maximum number of log lines returned by a single query. New rules return only the latest line in the time window by default; you can set 1-100. Leaving it empty means this rule has never had the setting, so Edge falls back to its old default of 100 lines.
39+
- `tencent_cls.limit` controls the maximum number of log lines returned by a single query; you can set 1-100. New rules store `1` by default, and Edge also uses 1 when the parameter is absent.
4040
- The query editor disables keyword autocompletion: raw mode is CQL/Lucene, and SQL keyword suggestions would only mislead.
4141

4242
### SQL Analysis (analysis)

en/monitors/data-sources/data-sources.mdx

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Relational databases share a similar configuration structure:
103103
| **Username** | Database username | - |
104104
| **Password** | Database password | - |
105105

106-
Oracle uses only the basic connection settings above. MySQL and PostgreSQL additionally support TLS/SSL encrypted connections, selected via the **TLS/SSL mode** dropdown.
106+
In addition to the basic connection settings above, Oracle supports multiple key-value **Options**. MySQL and PostgreSQL additionally support TLS/SSL encrypted connections, selected via the **TLS/SSL mode** dropdown.
107107

108108
#### TLS/SSL modes for MySQL
109109

@@ -134,9 +134,59 @@ In "Verify certificate authority" and "Verify certificate and hostname" modes, a
134134
Setting any mode other than "Disable TLS" requires all registered Edge instances in the associated alert engine cluster to be v0.50.0 or later.
135135
</Warning>
136136

137-
### Elasticsearch / Loki / ClickHouse / SLS / VictoriaLogs
137+
### Elasticsearch
138138

139-
These data sources have connection configurations similar to Prometheus, including server address, authentication, and TLS settings. The default server address for VictoriaLogs is `http://localhost:9428`. Refer to the creation form for specific parameters.
139+
Elasticsearch supports Cloud and Self-Managed deployments. Cloud is selected by default.
140+
141+
| Config Item | Cloud | Self-Managed | Default |
142+
|-------------|-------|--------------|---------|
143+
| **Cloud ID** | Required | - | - |
144+
| **API Key** | Required | - | - |
145+
| **Connection URL** | - | Required; separate multiple nodes with commas | - |
146+
| **Query timeout (milliseconds)** | Supported | Supported | 5000 |
147+
| **Headers** | - | Supports multiple custom request headers | - |
148+
| **Username / Password** | - | Required | - |
149+
| **Service Token** | - | Optional | - |
150+
| **CA certificate** | - | Optional | - |
151+
| **Certificate fingerprint** | - | Optional | - |
152+
153+
### Loki / VictoriaLogs
154+
155+
Loki and VictoriaLogs use the same HTTP connection structure as Prometheus: server URL, Headers, Params, Basic Authentication, and TLS settings such as a custom CA, mTLS, server name, TLS versions, and skipping certificate verification.
156+
157+
| Type | Example server URL |
158+
|------|--------------------|
159+
| **Loki** | `http://localhost:3100` |
160+
| **VictoriaLogs** | `http://localhost:9428` |
161+
162+
These addresses are input examples; the form does not save them as defaults automatically.
163+
164+
### ClickHouse
165+
166+
| Config Item | Description | Default |
167+
|-------------|-------------|---------|
168+
| **Connection URL** | ClickHouse Native protocol address; separate multiple nodes with commas | - |
169+
| **Max Connections** | Maximum open connections in the pool | 32 |
170+
| **Idle Connections** | Maximum idle connections in the pool | 4 |
171+
| **Connection Lifetime (seconds)** | Maximum connection lifetime | 600 |
172+
| **Query timeout (milliseconds)** | Timeout for each query | 5000 |
173+
| **Maximum execution time (seconds)** | Query execution limit sent to ClickHouse | 60 |
174+
| **Connection timeout (milliseconds)** | Timeout for establishing a connection | 2000 |
175+
| **Username / Password** | ClickHouse credentials | - |
176+
| **Database** | Optional default database | - |
177+
178+
After you enable **TLS**, you can configure a custom CA, mTLS, server name, minimum / maximum TLS versions, and skipping server certificate verification. Disabling TLS clears these TLS fields from the form.
179+
180+
### Aliyun SLS
181+
182+
| Config Item | Description |
183+
|-------------|-------------|
184+
| **Endpoint** | SLS endpoint, such as `cn-hangzhou.log.aliyuncs.com`. Do not include an `http://` or `https://` prefix |
185+
| **Headers** | Optional custom request headers; supports multiple Key-Value pairs |
186+
| **AccessKey ID** | Alibaba Cloud access key ID, required |
187+
| **AccessKey Secret** | Alibaba Cloud access key secret, required |
188+
189+
The SLS form does not provide separate TLS settings. AccessKey ID and AccessKey Secret support the Edge environment variable references described below.
140190

141191
### Tencent CLS
142192

zh/monitors/alert-rules/elasticsearch.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ Monitors 通过 ElasticSearch SQL 功能实现对日志和指标数据的监控
1515
| 配置项 | 说明 |
1616
|--------|------|
1717
| **查询语言** | 目前仅支持 SQL 语法 |
18-
| **字段处理** | 所有字段名自动转换为小写,配置时请使用小写字母 |
18+
| **字段处理** | 保留 Elasticsearch SQL 返回的列名大小写。配置标签字段和值字段时,请使用查询实际返回的列名 |
19+
20+
<Tip>
21+
建议在 SQL 中使用明确且稳定的列别名,并在字段映射中使用完全相同的大小写,避免查询字段变更后无法匹配。
22+
</Tip>
1923

2024
## 1. 阈值判定模式 (Threshold)
2125

zh/monitors/alert-rules/query-result-fields.mdx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: "说明如何把 SQL 和原文日志查询结果配置为值字段
44
keywords: ["查询结果", "值字段", "标签字段", "附加信息", "阈值表达式", "多查询"]
55
---
66

7-
MySQL、PostgreSQL、Oracle、ClickHouse、Elasticsearch、SLS 等表格型查询,以及 Loki 和 VictoriaLogs **查原文**模式,都会返回包含多列数据的结果。你可以通过**值字段****标签字段**决定每一列的用途;其余列无需单独配置,会作为附加信息随告警携带。
7+
MySQL、PostgreSQL、Oracle、ClickHouse、Elasticsearch、SLS 和 Tencent CLS 等表格型查询,以及 Loki、VictoriaLogs、SLSTencent CLS **原始日志**查询,都会返回包含多列数据的结果。你可以通过**值字段****标签字段**决定每一列的用途;其余列无需单独配置,会作为附加信息随告警携带。
88

99
<Warning>
1010
本页描述的完整字段映射行为需要 monit-edge `v0.53.0` 或以上版本,尤其是将查询附加信息统一命名为 `$<查询名称>.<字段名称>` 的能力。使用这些配置前,请先将告警引擎升级到 `v0.53.0` 或更高版本。
@@ -69,6 +69,8 @@ MySQL、PostgreSQL、Oracle、ClickHouse、Elasticsearch、SLS 等表格型查
6969

7070
SLS 查询结果自带的 `__source__``__time__` 不会在标签字段留空时自动成为标签。如需使用这些内容,建议在查询中设置别名,再按普通字段配置。
7171

72+
Tencent CLS 原始日志还可能包含 `__cls_*` 元数据字段。Monitors 不会自动排除这些字段;建议明确选择服务、主机、Topic 等稳定字段作为标签,把日志正文、时间和请求级标识留作附加信息。
73+
7274
## 在阈值表达式中引用值
7375

7476
查询名称就是阈值变量的前缀。例如,查询 A 的值字段为 `error_count`
@@ -142,10 +144,19 @@ Critical: $A.error_count > 20 and $B.latency_ms > 1000
142144

143145
## 查询结果行数上限
144146

145-
所有告警规则查询都有 **1000 行** 的硬性上限,包括阈值判定、数据存在、数据缺失的判定查询,以及恢复查询和关联查询。查询返回超过 1000 行时,该查询直接失败(错误信息 `too many rows`),本次判定报错,不会产生告警。
147+
Edge 分别限制周期告警查询和交互预览查询。以下是默认值,部署者可以独立调整:
148+
149+
| 场景 | 默认上限 | Edge 参数 | 覆盖范围 |
150+
|------|----------|-----------|----------|
151+
| **周期告警查询** | 1,000,000 行 | `--alerter.alertQueryMaxRows` | 主查询、恢复查询和关联查询 |
152+
| **数据预览查询** | 1,000 行 | `--alerter.previewMaxRows` | 数据源查询与规则编辑页预览 |
153+
154+
数据源自身的限制可能更严格。例如,SLS、Tencent CLS、Loki 和 VictoriaLogs 的原始日志查询最多允许配置 100 条。实际生效上限取场景上限与数据源限制中的更小值。
155+
156+
查询超过实际生效上限时会直接失败(错误信息 `too many rows`),不会返回部分结果,也不会使用截断后的数据继续判定。
146157

147158
<Warning>
148-
该上限对所有数据源类型生效(MySQL、PostgreSQL、Oracle、ClickHouse、Elasticsearch、SLS、Loki、VictoriaLogs、Prometheus 等)。高基数 Prometheus 查询(超过 1000 条序列)或返回大结果集的 SQL 查询会因此报错而不再产生告警
159+
提高 Edge 行数上限不会取消响应字节数、字段大小或结果值数量等资源保护。高基数 Prometheus 查询或大型 SQL 结果仍可能因为其他资源上限而失败
149160
</Warning>
150161

151162
建议在数据源侧完成聚合,而不是让一条规则查询返回大量行:
@@ -160,7 +171,7 @@ Critical: $A.error_count > 20 and $B.latency_ms > 1000
160171

161172
本页适用于:
162173

163-
- MySQL、PostgreSQL、Oracle、ClickHouse、Elasticsearch 和 SLS 查询
164-
- Loki 和 VictoriaLogs **查原文**主查询
174+
- MySQL、PostgreSQL、Oracle、ClickHouse、Elasticsearch、SLSTencent CLS 查询
175+
- Loki、VictoriaLogs、SLSTencent CLS **原始日志**主查询
165176

166177
Loki 和 VictoriaLogs 的**做统计**模式会直接返回带标签的时序数据,不需要手工映射这些结果字段。

zh/monitors/alert-rules/tencent-cls.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Monitors 通过腾讯云日志服务 CLS 的检索与分析接口获取数据,
2626
| `tencent_cls.syntax` | 检索语法:`CQL` / `Lucene`,用于原始日志检索 | `cql` |
2727
| `tencent_cls.timespan.value` | 时间跨度数值 | `15` |
2828
| `tencent_cls.timespan.unit` | 时间跨度单位:`s`(秒)、`m`(分)、`h`(时)、`d`(天) | `m` |
29-
| `tencent_cls.limit` | 最大返回条数,仅 raw 模式有效,取值范围 1~100 | 新建规则为 `1` |
29+
| `tencent_cls.limit` | 最大返回条数,仅 raw 模式有效,取值范围 1~100 | `1` |
3030

3131
地域下拉提供常用地域建议列表(如 ap-guangzhou、ap-shanghai、ap-beijing 等),仅为建议而非白名单;也可以输入任意符合 `[a-z0-9-]` 形状的地域 code,能否使用由腾讯云判定。
3232

@@ -37,7 +37,7 @@ Monitors 通过腾讯云日志服务 CLS 的检索与分析接口获取数据,
3737
使用 CQL 或 Lucene 语法检索日志,返回匹配的日志行。每返回一条日志,就可能生成一条告警。
3838

3939
- 时间窗口最长 **6 小时**
40-
-`tencent_cls.limit` 控制单次最多返回的日志条数。新建规则默认只取时间窗口内最新 1 条,可填 1~100;留空表示这条规则从未配置过该项,Edge 沿用旧的默认值 100 条
40+
-`tencent_cls.limit` 控制单次最多返回的日志条数,可填 1~100。新建规则默认写入 `1`;参数缺失时,Edge 也按 `1` 条执行
4141
- 查询编辑器不提供关键字补全:raw 模式写的是 CQL/Lucene,SQL 关键字补全只会误导。
4242

4343
### SQL 分析(analysis)

0 commit comments

Comments
 (0)