Skip to content

Commit 3009efe

Browse files
shuiyisongnicecui
andauthored
docs: add docs for prom and loki with pipeline (#1943)
Signed-off-by: shuiyisong <[email protected]> Co-authored-by: Yiran <[email protected]>
1 parent b038b92 commit 3009efe

File tree

8 files changed

+280
-4
lines changed

8 files changed

+280
-4
lines changed

docs/user-guide/ingest-data/for-observability/loki.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,35 @@ WITH(
125125
append_mode = 'true'
126126
)
127127
1 row in set (0.00 sec)
128-
```
128+
```
129+
130+
## Using pipeline in Loki push API
131+
132+
:::warning Experimental Feature
133+
This experimental feature may contain unexpected behavior, have its functionality change in the future.
134+
:::
135+
136+
Starting from `v0.15`, GreptimeDB supports using pipeline to process Loki push requests.
137+
You can simply set the HTTP header `x-greptime-pipeline-name` to the target pipeline name to enable pipeline processing.
138+
139+
Note, if the request data go through the pipeline engine, GreptimeDB will add prefix to the label and metadata column names:
140+
- `loki_label_` before each label name
141+
- `loki_metadata_` before each structured metadata name
142+
- The original Loki log line would be named `loki_line`
143+
144+
An example of data model using `greptime_identity` would be like the following:
145+
```
146+
mysql> select * from loki_logs limit 1;
147+
+----------------------------+---------------------+---------------------------+---------------------------------------------------------------------------+
148+
| greptime_timestamp | loki_label_platform | loki_label_service_name | loki_line |
149+
+----------------------------+---------------------+---------------------------+---------------------------------------------------------------------------+
150+
| 2025-07-15 11:40:26.651141 | docker | docker-monitoring-alloy-1 | ts=2025-07-15T11:40:15.532342849Z level=info "boringcrypto enabled"=false |
151+
+----------------------------+---------------------+---------------------------+---------------------------------------------------------------------------+
152+
1 row in set (0.00 sec)
153+
```
154+
155+
You can see that the label column names are prefixed with `loki_label_`.
156+
The actual log line is named `loki_line`.
157+
You can use a custom pipeline to process the data. It would be working like a normal pipeline process.
158+
159+
You can refer to the [pipeline's documentation](/user-guide/logs/pipeline-config.md) for more details.

docs/user-guide/ingest-data/for-observability/prometheus.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,44 @@ It can also be helpful to group metrics by their frequency.
217217
Note, each metric's logical table is bound to a physical table upon creation.
218218
So setting different physical table for the same metric within the same database won't work.
219219

220+
## Using pipeline in remote write
221+
222+
:::warning Experimental Feature
223+
This experimental feature may contain unexpected behavior, have its functionality change in the future.
224+
:::
225+
226+
Starting from `v0.15`, GreptimeDB supports using pipeline to process Prometheus remote write requests.
227+
You can simply set the HTTP header `x-greptime-pipeline-name` to the target pipeline name to enable pipeline processing.
228+
229+
Here is a very simple pipeline configuration, using `vrl` processor to add a `source` label to each metric:
230+
```YAML
231+
version: 2
232+
processors:
233+
- vrl:
234+
source: |
235+
.source = "local_laptop"
236+
.
237+
238+
transform:
239+
- field: greptime_timestamp
240+
type: time, ms
241+
index: timestamp
242+
```
243+
244+
The result looks something like this
245+
```
246+
mysql> select * from `go_memstats_mcache_inuse_bytes`;
247+
+----------------------------+----------------+--------------------+---------------+--------------+
248+
| greptime_timestamp | greptime_value | instance | job | source |
249+
+----------------------------+----------------+--------------------+---------------+--------------+
250+
| 2025-07-11 07:42:03.064000 | 1200 | node_exporter:9100 | node-exporter | local_laptop |
251+
| 2025-07-11 07:42:18.069000 | 1200 | node_exporter:9100 | node-exporter | local_laptop |
252+
+----------------------------+----------------+--------------------+---------------+--------------+
253+
2 rows in set (0.01 sec)
254+
```
255+
256+
You can refer to the [pipeline's documentation](/user-guide/logs/pipeline-config.md) for more details.
257+
220258
## Performance tuning
221259

222260
By default, the metric engine will automatically create a physical table named `greptime_physical_table` if it does not already exist. For performance optimization, you may choose to create a physical table with customized configurations.

i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/loki.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,35 @@ WITH(
124124
append_mode = 'true'
125125
)
126126
1 row in set (0.00 sec)
127-
```
127+
```
128+
129+
## Using pipeline in Loki push API
130+
131+
:::warning 实验性特性
132+
此实验性功能可能存在预期外的行为,其功能未来可能发生变化。
133+
:::
134+
135+
`v0.15` 开始,GreptimeDB 支持使用 pipeline 来处理 Loki 的写入请求。
136+
你可以通过在 HTTP header 中将 `x-greptime-pipeline-name` 的值设置为需要执行的 pipeline 名称来使用 pipeline 处理流程。
137+
138+
请注意,如果使用 pipeline 处理流程,GreptimeDB 将会在 label 和 structure metadata 的列名前加上前缀:
139+
- 对 label 列,加上 `loki_label_` 的前缀
140+
- 对 structured metadata 列,加上 `loki_metadata_` 的前缀
141+
- Loki 自身的日志行则会被命名为 `loki_line`
142+
143+
一个使用 `greptime_identity` 的数据样例将如下所示:
144+
```
145+
mysql> select * from loki_logs limit 1;
146+
+----------------------------+---------------------+---------------------------+---------------------------------------------------------------------------+
147+
| greptime_timestamp | loki_label_platform | loki_label_service_name | loki_line |
148+
+----------------------------+---------------------+---------------------------+---------------------------------------------------------------------------+
149+
| 2025-07-15 11:40:26.651141 | docker | docker-monitoring-alloy-1 | ts=2025-07-15T11:40:15.532342849Z level=info "boringcrypto enabled"=false |
150+
+----------------------------+---------------------+---------------------------+---------------------------------------------------------------------------+
151+
1 row in set (0.00 sec)
152+
```
153+
154+
可以见到 label 列的名称加上了 `loki_label_` 的前缀。
155+
实际的日志列则被命名为 `loki_line`
156+
你可以使用一个自定义的 pipeline 来处理数据,这将和其他 pipeline 处理流程一致。
157+
158+
更多配置详情请参考 [pipeline 相关文档](/user-guide/logs/pipeline-config.md)

i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/prometheus.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,44 @@ GreptimeDB 可以识别一些标签的名称,并将它们转换成写入时的
208208

209209
注意,指标的逻辑表在创建时就与物理表一一关联。在同一数据库下为同一指标设定不同的物理表不会生效。
210210

211+
## 在 Remote write 中使用 pipeline
212+
213+
:::warning 实验性特性
214+
此实验性功能可能存在预期外的行为,其功能未来可能发生变化。
215+
:::
216+
217+
`v0.15` 开始,GreptimeDB 支持在 Prometheus Remote Write 协议入口使用 pipeline 处理数据。
218+
你可以通过在 HTTP header 中将 `x-greptime-pipeline-name` 的值设置为需要执行的 pipeline 名称来使用 pipeline 处理流程。
219+
220+
以下是一个非常简单的 pipeline 配置例子,使用 `vrl` 处理器来对每个指标增加一个 `source` 标签:
221+
```YAML
222+
version: 2
223+
processors:
224+
- vrl:
225+
source: |
226+
.source = "local_laptop"
227+
.
228+
229+
transform:
230+
- field: greptime_timestamp
231+
type: time, ms
232+
index: timestamp
233+
```
234+
235+
结果如下所示
236+
```
237+
mysql> select * from `go_memstats_mcache_inuse_bytes`;
238+
+----------------------------+----------------+--------------------+---------------+--------------+
239+
| greptime_timestamp | greptime_value | instance | job | source |
240+
+----------------------------+----------------+--------------------+---------------+--------------+
241+
| 2025-07-11 07:42:03.064000 | 1200 | node_exporter:9100 | node-exporter | local_laptop |
242+
| 2025-07-11 07:42:18.069000 | 1200 | node_exporter:9100 | node-exporter | local_laptop |
243+
+----------------------------+----------------+--------------------+---------------+--------------+
244+
2 rows in set (0.01 sec)
245+
```
246+
247+
更多配置详情请参考 [pipeline 相关文档](/user-guide/logs/pipeline-config.md)
248+
211249
## 性能优化
212250

213251
默认情况下,metric engine 会自动创建一个名为 `greptime_physical_table` 的物理表。

i18n/zh/docusaurus-plugin-content-docs/version-0.15/user-guide/ingest-data/for-observability/loki.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,35 @@ WITH(
124124
append_mode = 'true'
125125
)
126126
1 row in set (0.00 sec)
127-
```
127+
```
128+
129+
## Using pipeline in Loki push API
130+
131+
:::warning 实验性特性
132+
此实验性功能可能存在预期外的行为,其功能未来可能发生变化。
133+
:::
134+
135+
`v0.15` 开始,GreptimeDB 支持使用 pipeline 来处理 Loki 的写入请求。
136+
你可以通过在 HTTP header 中将 `x-greptime-pipeline-name` 的值设置为需要执行的 pipeline 名称来使用 pipeline 处理流程。
137+
138+
请注意,如果使用 pipeline 处理流程,GreptimeDB 将会在 label 和 structure metadata 的列名前加上前缀:
139+
- 对 label 列,加上 `loki_label_` 的前缀
140+
- 对 structured metadata 列,加上 `loki_metadata_` 的前缀
141+
- Loki 自身的日志行则会被命名为 `loki_line`
142+
143+
一个使用 `greptime_identity` 的数据样例将如下所示:
144+
```
145+
mysql> select * from loki_logs limit 1;
146+
+----------------------------+---------------------+---------------------------+---------------------------------------------------------------------------+
147+
| greptime_timestamp | loki_label_platform | loki_label_service_name | loki_line |
148+
+----------------------------+---------------------+---------------------------+---------------------------------------------------------------------------+
149+
| 2025-07-15 11:40:26.651141 | docker | docker-monitoring-alloy-1 | ts=2025-07-15T11:40:15.532342849Z level=info "boringcrypto enabled"=false |
150+
+----------------------------+---------------------+---------------------------+---------------------------------------------------------------------------+
151+
1 row in set (0.00 sec)
152+
```
153+
154+
可以见到 label 列的名称加上了 `loki_label_` 的前缀。
155+
实际的日志列则被命名为 `loki_line`
156+
你可以使用一个自定义的 pipeline 来处理数据,这将和其他 pipeline 处理流程一致。
157+
158+
更多配置详情请参考 [pipeline 相关文档](/user-guide/logs/pipeline-config.md)

i18n/zh/docusaurus-plugin-content-docs/version-0.15/user-guide/ingest-data/for-observability/prometheus.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,44 @@ GreptimeDB 可以识别一些标签的名称,并将它们转换成写入时的
208208

209209
注意,指标的逻辑表在创建时就与物理表一一关联。在同一数据库下为同一指标设定不同的物理表不会生效。
210210

211+
## 在 Remote write 中使用 pipeline
212+
213+
:::warning 实验性特性
214+
此实验性功能可能存在预期外的行为,其功能未来可能发生变化。
215+
:::
216+
217+
`v0.15` 开始,GreptimeDB 支持在 Prometheus Remote Write 协议入口使用 pipeline 处理数据。
218+
你可以通过在 HTTP header 中将 `x-greptime-pipeline-name` 的值设置为需要执行的 pipeline 名称来使用 pipeline 处理流程。
219+
220+
以下是一个非常简单的 pipeline 配置例子,使用 `vrl` 处理器来对每个指标增加一个 `source` 标签:
221+
```YAML
222+
version: 2
223+
processors:
224+
- vrl:
225+
source: |
226+
.source = "local_laptop"
227+
.
228+
229+
transform:
230+
- field: greptime_timestamp
231+
type: time, ms
232+
index: timestamp
233+
```
234+
235+
结果如下所示
236+
```
237+
mysql> select * from `go_memstats_mcache_inuse_bytes`;
238+
+----------------------------+----------------+--------------------+---------------+--------------+
239+
| greptime_timestamp | greptime_value | instance | job | source |
240+
+----------------------------+----------------+--------------------+---------------+--------------+
241+
| 2025-07-11 07:42:03.064000 | 1200 | node_exporter:9100 | node-exporter | local_laptop |
242+
| 2025-07-11 07:42:18.069000 | 1200 | node_exporter:9100 | node-exporter | local_laptop |
243+
+----------------------------+----------------+--------------------+---------------+--------------+
244+
2 rows in set (0.01 sec)
245+
```
246+
247+
更多配置详情请参考 [pipeline 相关文档](/user-guide/logs/pipeline-config.md)
248+
211249
## 性能优化
212250

213251
默认情况下,metric engine 会自动创建一个名为 `greptime_physical_table` 的物理表。

versioned_docs/version-0.15/user-guide/ingest-data/for-observability/loki.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,35 @@ WITH(
125125
append_mode = 'true'
126126
)
127127
1 row in set (0.00 sec)
128-
```
128+
```
129+
130+
## Using pipeline in Loki push API
131+
132+
:::warning Experimental Feature
133+
This experimental feature may contain unexpected behavior, have its functionality change in the future.
134+
:::
135+
136+
Starting from `v0.15`, GreptimeDB supports using pipeline to process Loki push requests.
137+
You can simply set the HTTP header `x-greptime-pipeline-name` to the target pipeline name to enable pipeline processing.
138+
139+
Note, if the request data go through the pipeline engine, GreptimeDB will add prefix to the label and metadata column names:
140+
- `loki_label_` before each label name
141+
- `loki_metadata_` before each structured metadata name
142+
- The original Loki log line would be named `loki_line`
143+
144+
An example of data model using `greptime_identity` would be like the following:
145+
```
146+
mysql> select * from loki_logs limit 1;
147+
+----------------------------+---------------------+---------------------------+---------------------------------------------------------------------------+
148+
| greptime_timestamp | loki_label_platform | loki_label_service_name | loki_line |
149+
+----------------------------+---------------------+---------------------------+---------------------------------------------------------------------------+
150+
| 2025-07-15 11:40:26.651141 | docker | docker-monitoring-alloy-1 | ts=2025-07-15T11:40:15.532342849Z level=info "boringcrypto enabled"=false |
151+
+----------------------------+---------------------+---------------------------+---------------------------------------------------------------------------+
152+
1 row in set (0.00 sec)
153+
```
154+
155+
You can see that the label column names are prefixed with `loki_label_`.
156+
The actual log line is named `loki_line`.
157+
You can use a custom pipeline to process the data. It would be working like a normal pipeline process.
158+
159+
You can refer to the [pipeline's documentation](/user-guide/logs/pipeline-config.md) for more details.

versioned_docs/version-0.15/user-guide/ingest-data/for-observability/prometheus.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,44 @@ It can also be helpful to group metrics by their frequency.
217217
Note, each metric's logical table is bound to a physical table upon creation.
218218
So setting different physical table for the same metric within the same database won't work.
219219

220+
## Using pipeline in remote write
221+
222+
:::warning Experimental Feature
223+
This experimental feature may contain unexpected behavior, have its functionality change in the future.
224+
:::
225+
226+
Starting from `v0.15`, GreptimeDB supports using pipeline to process Prometheus remote write requests.
227+
You can simply set the HTTP header `x-greptime-pipeline-name` to the target pipeline name to enable pipeline processing.
228+
229+
Here is a very simple pipeline configuration, using `vrl` processor to add a `source` label to each metric:
230+
```YAML
231+
version: 2
232+
processors:
233+
- vrl:
234+
source: |
235+
.source = "local_laptop"
236+
.
237+
238+
transform:
239+
- field: greptime_timestamp
240+
type: time, ms
241+
index: timestamp
242+
```
243+
244+
The result looks something like this
245+
```
246+
mysql> select * from `go_memstats_mcache_inuse_bytes`;
247+
+----------------------------+----------------+--------------------+---------------+--------------+
248+
| greptime_timestamp | greptime_value | instance | job | source |
249+
+----------------------------+----------------+--------------------+---------------+--------------+
250+
| 2025-07-11 07:42:03.064000 | 1200 | node_exporter:9100 | node-exporter | local_laptop |
251+
| 2025-07-11 07:42:18.069000 | 1200 | node_exporter:9100 | node-exporter | local_laptop |
252+
+----------------------------+----------------+--------------------+---------------+--------------+
253+
2 rows in set (0.01 sec)
254+
```
255+
256+
You can refer to the [pipeline's documentation](/user-guide/logs/pipeline-config.md) for more details.
257+
220258
## Performance tuning
221259

222260
By default, the metric engine will automatically create a physical table named `greptime_physical_table` if it does not already exist. For performance optimization, you may choose to create a physical table with customized configurations.

0 commit comments

Comments
 (0)