From a75d48dc095d091536145d6cb40849a77e9cc589 Mon Sep 17 00:00:00 2001 From: paomian Date: Tue, 26 Nov 2024 16:02:19 +0800 Subject: [PATCH] chore: fix loki doc error --- docs/user-guide/ingest-data/for-observerbility/loki.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/user-guide/ingest-data/for-observerbility/loki.md b/docs/user-guide/ingest-data/for-observerbility/loki.md index a2090a247..9068661f0 100644 --- a/docs/user-guide/ingest-data/for-observerbility/loki.md +++ b/docs/user-guide/ingest-data/for-observerbility/loki.md @@ -4,7 +4,7 @@ ### API -To send OpenTelemetry Logs to GreptimeDB through OpenTelemetry SDK libraries, use the following information: +To send Logs to GreptimeDB through Raw HTTP API, use the following information: * URL: `http{s}:///v1/loki/api/v1/push` * Headers: @@ -12,11 +12,13 @@ To send OpenTelemetry Logs to GreptimeDB through OpenTelemetry SDK libraries, us * `Authorization`: `Basic` authentication, which is a Base64 encoded string of `:`. For more information, please refer to [Authentication](https://docs.greptime.com/user-guide/deployments/authentication/static/) and [HTTP API](https://docs.greptime.com/user-guide/protocols/http#authentication). * `X-Greptime-Log-Table-Name`: `` (optional) - The table name to store the logs. If not provided, the default table name is `loki_logs`. + The request uses binary protobuf to encode the payload, The defined schema is the same as the [logproto.proto](https://github.com/grafana/loki/blob/main/pkg/logproto/logproto.proto). + ### Example Code [Grafana Alloy](https://grafana.com/docs/alloy/latest/) is a vendor-neutral distribution of the OpenTelemetry (OTel) Collector. Alloy uniquely combines the very best OSS observability signals in the community. -It suplies a Loki exporter that can be used to send logs to GreptimeDB. +It suplies a Loki exporter that can be used to send logs to GreptimeDB. Here is an example configuration: ```hcl loki.source.file "greptime" { @@ -41,6 +43,10 @@ loki.write "greptime_loki" { } ``` +We listen to the file `/tmp/foo.txt` and send the logs to GreptimeDB. The logs are stored in the table `loki_demo_logs` with the external labels `job` and `from`. + +For more information, please refer to the [Grafana Alloy loki.write documentation](https://grafana.com/docs/alloy/latest/reference/components/loki/loki.write/). + You can run the following command to check the data in the table: ```sql