Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add fluent bit doc #1545

Merged
merged 16 commits into from
Mar 17, 2025
88 changes: 88 additions & 0 deletions docs/greptimecloud/integrations/fluent-bit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
keywords: [Fluent Bit, GreptimeCloud, metrics ingestion, logs ingestion, data pipeline]
description: Guide for using Fluent Bit with GreptimeCloud, including configuration for metrics and logs ingestion, and running Fluent Bit with a sample configuration.
---


# Fluent Bit

Fluent Bit is a lightweight and fast log processor and forwarder that can collect, parse, filter, and forward logs and metrics. Fluent Bit is part of the Fluentd project ecosystem and is written in C language. It is designed to be memory-efficient and performant, making it suitable for use in resource-constrained environments.

## HTTP

Fluent Bit can be configured to send logs to GreptimeCloud using the HTTP protocol. This allows you to collect logs from various sources and send them to GreptimeCloud for storage, analysis, and visualization.

```
[OUTPUT]
Name http
Match *
Host <host>
Port 443
Uri /v1/events/logs?db=<dbname>&table=<table_name>&pipeline_name=<pipeline_name>
Format json
Json_date_key scrape_timestamp
Json_date_format iso8601
Tls On
compress gzip
http_User <username>
http_Passwd <password>
```

In this example, the `http` output plugin is used to send logs to GreptimeCloud. For more information, and extra options, refer to the [Logs HTTP API](https://docs.greptime.com/user-guide/ingest-data/for-observability/logs) guide.

## Prometheus Remote Write

Fluent Bit can be configured to send metrics to GreptimeCloud using the Prometheus Remote Write protocol. This allows you to collect metrics from various sources and send them to GreptimeCloud for storage, analysis, and visualization.

```
[OUTPUT]
Name prometheus_remote_write
Match internal_metrics
Host <host>
Port 443
Uri /v1/prometheus/write?db=<dbname>
Tls On
http_user <username>
http_passwd <password>
```

In this example, the `prometheus_remote_write` output plugin is used to send metrics to GreptimeCloud. For more information, and extra options, refer to the [Prometheus Remote Write](https://docs.greptime.com/user-guide/integrations/prometheus) guide.

## OpenTelemetry

Fluent Bit can be configured to send logs and metrics to GreptimeCloud using the OpenTelemetry protocol. This allows you to collect logs and metrics from various sources and send them to GreptimeCloud for storage, analysis, and visualization.

```
# Only for metrics
[OUTPUT]
Name opentelemetry
Alias opentelemetry_metrics
Match *_metrics
Host <host>
Port 443
Metrics_uri /v1/otlp/v1/metrics
http_User <username>
http_Passwd <password>
Log_response_payload True
Tls On
compress gzip

# Only for logs
[OUTPUT]
Name opentelemetry
Alias opentelemetry_logs
Match *_logs
Host <host>
Port 443
Logs_uri /v1/otlp/v1/logs
http_User <username>
http_Passwd <password>
Log_response_payload True
Tls On
compress gzip
Header X-Greptime-Log-Table-Name "<log_table_name>"
Header X-Greptime-Log-Pipeline-Name "<pipeline_name>"
Header X-Greptime-DB-Name "<dbname>"
```

In this example, the [OpenTelemetry OTLP/HTTP API](https://docs.greptime.com/nightly/user-guide/ingest-data/for-observability/opentelemetry) interface is used. For more information, and extra options, refer to the [OpenTelemetry](https://docs.greptime.com/nightly/user-guide/ingest-data/for-observability/opentelemetry) guide.
129 changes: 129 additions & 0 deletions docs/user-guide/ingest-data/for-observability/fluent-bit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
---
keywords: [Fluent bit, Prometheus Remote Write, OpenTelemetry, data pipeline]
description: Instructions on integrating GreptimeDB with Fluent bit for Prometheus Remote Write and OpenTelemetry.
---

# Fluent Bit

[Fluent Bit](http://fluentbit.io/) is a fast and lightweight telemetry agent for logs, metrics, and traces for Linux, macOS, Windows, and BSD family operating systems. Fluent Bit has been made with a strong focus on performance to allow the collection and processing of telemetry data from different sources without complexity.

You can integrate GreptimeDB as an OUTPUT for Fluent Bit.

## Http

Using Fluent Bit's [HTTP Output Plugin](https://docs.fluentbit.io/manual/pipeline/outputs/http), you can send logs to GreptimeDB.

```conf
[OUTPUT]
Name http
Match *
Host greptimedb
Port 4000
Uri /v1/events/logs?db=public&table=your_table&pipeline_name=pipeline_if_any
Format json
Json_date_key scrape_timestamp
Json_date_format iso8601
compress gzip
http_User <username>
http_Passwd <password>
```

- `host`: GreptimeDB host address, e.g., `localhost`.
- `port`: GreptimeDB port, default is `4000`.
- `uri`: The endpoint to send logs to.
- `format`: The format of the logs, needs to be `json`.
- `json_date_key`: The key in the JSON object that contains the timestamp.
- `json_date_format`: The format of the timestamp.
- `compress`: The compression method to use, e.g., `gzip`.
- `header`: The header to send with the request, e.g., `Authorization` for authentication.
- `http_user` and `http_passwd`: The [authentication credentials](/user-guide/deployments/authentication/static.md) for GreptimeDB.

In params Uri,
- `db` is the database name you want to write logs to.
- `table` is the table name you want to write logs to.
- `pipeline_name` is the pipeline name you want to use for processing logs.

In this example, the [Logs Http API](/user-guide/logs/write-logs.md#http-api) interface is used. For more information, refer to the [Write Logs](/user-guide/logs/write-logs.md) guide.

## OpenTelemetry

GreptimeDB can also be configured as OpenTelemetry collector. Using Fluent Bit's [OpenTelemetry Output Plugin](https://docs.fluentbit.io/manual/pipeline/outputs/opentelemetry), you can send metrics, logs, and traces to GreptimeDB.

```
[OUTPUT]
Name opentelemetry
Match *
Host 127.0.0.1
Port 4000
Metrics_uri /v1/otlp/v1/metrics
Logs_uri /v1/otlp/v1/logs
Traces_uri /v1/otlp/v1/traces
Log_response_payload True
Tls Off
Tls.verify Off
logs_body_key message
http_User <username>
http_Passwd <password>
```

- `Metrics_uri`, `Logs_uri`, and `Traces_uri`: The endpoint to send metrics, logs, and traces to.
- `http_user` and `http_passwd`: The [authentication credentials](/user-guide/deployments/authentication/static.md) for GreptimeDB.

We recommend not writing metrics, logs, and traces to a single output simultaneously, as each has specific header options for specifying parameters. We suggest creating a separate OpenTelemetry output for metrics, logs, and traces. for example:

```
# Only for metrics
[OUTPUT]
Name opentelemetry
Alias opentelemetry_metrics
Match *
Host 127.0.0.1
Port 4000
Metrics_uri /v1/otlp/v1/metrics
Log_response_payload True
Tls Off
Tls.verify Off

# Only for logs
[OUTPUT]
Name opentelemetry
Alias opentelemetry_logs
Match *
Host 127.0.0.1
Port 4000
Logs_uri /v1/otlp/v1/logs
Log_response_payload True
Tls Off
Tls.verify Off
Header X-Greptime-Log-Table-Name "<log_table_name>"
Header X-Greptime-Log-Pipeline-Name "<pipeline_name>"
Header X-Greptime-DB-Name "<dbname>"
```


In this example, the [OpenTelemetry OTLP/HTTP API](/user-guide/ingest-data/for-observability/opentelemetry.md#opentelemetry-collectors) interface is used. For more information, and extra options, refer to the [OpenTelemetry](/user-guide/ingest-data/for-observability/opentelemetry.md) guide.

## Prometheus Remote Write

Configure GreptimeDB as remote write target:

```
[OUTPUT]
Name prometheus_remote_write
Match internal_metrics
Host 127.0.0.1
Port 4000
Uri /v1/prometheus/write?db=<dbname>
Tls Off
http_user <username>
http_passwd <password>
```

- `Uri`: The endpoint to send metrics to.
- `http_user` and `http_passwd`: The [authentication credentials](/user-guide/deployments/authentication/static.md) for GreptimeDB.

In params Uri,

- `db` is the database name you want to write metrics to.

For details on the data model transformation from Prometheus to GreptimeDB, refer to the [Data Model](/user-guide/ingest-data/for-observability/prometheus.md#data-model) section in the Prometheus Remote Write guide.
9 changes: 9 additions & 0 deletions docs/user-guide/integrations/fluent-bit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
keywords: [Fluent bit, Prometheus Remote Write, OpenTelemetry, data pipeline]
description: Integrate GreptimeDB with Fluent Bit.
---

# Fluent Bit

You can set GreptimeDB as a Output for Fluent Bit.
For more information, please refer to the [Writing Data with Fluent Bit](../ingest-data/for-observability/fluent-bit.md) guide.
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
keywords: [Fluent Bit, GreptimeCloud, 指标写入, 日志写入, 数据管道]
description: 使用 Fluent Bit 和 GreptimeCloud 的指南,包括指标和日志写入的配置,以及运行 Fluent Bit 的示例配置。
---

# Fluent Bit

Fluent Bit 是一个轻量且快速的日志处理和转发器,可以收集、解析、过滤和转发日志和指标。Fluent Bit 是 Fluentd 项目生态系统的一部分,用 C 语言编写。它设计为内存高效且性能优越,适合在资源受限的环境中使用。

## HTTP

Fluent Bit 可以配置为使用 HTTP 协议将日志发送到 GreptimeCloud。这允许您从各种来源收集日志并将其发送到 GreptimeCloud 进行存储、分析和可视化。

```
[OUTPUT]
Name http
Match *
Host <host>
Port 443
Uri /v1/events/logs?db=<dbname>&table=<table_name>&pipeline_name=<pipeline_name>
Format json
Json_date_key scrape_timestamp
Json_date_format iso8601
Tls On
compress gzip
http_User <username>
http_Passwd <password>
```

在此示例中,使用 `http` 输出插件将日志发送到 GreptimeCloud。有关更多信息和额外选项,请参阅 [Logs HTTP API](https://docs.greptime.com/zh/nightly/user-guide/ingest-data/for-observability/logs) 指南。

## Prometheus Remote Write

Fluent Bit 可以配置为使用 Prometheus Remote Write 协议将指标发送到 GreptimeCloud。这允许您从各种来源收集指标并将其发送到 GreptimeCloud 进行存储、分析和可视化。

```
[OUTPUT]
Name prometheus_remote_write
Match internal_metrics
Host <host>
Port 443
Uri /v1/prometheus/write?db=<dbname>
Tls On
http_user <username>
http_passwd <password>
```

在此示例中,使用 `prometheus_remote_write` 输出插件将指标发送到 GreptimeCloud。有关更多信息和额外选项,请参阅 [Prometheus Remote Write](https://docs.greptime.com/zh/nightly/user-guide/ingest-data/for-observability/prometheus) 指南。

## OpenTelemetry

Fluent Bit 可以配置为使用 OpenTelemetry 协议将日志和指标发送到 GreptimeCloud。这允许您从各种来源收集日志和指标并将其发送到 GreptimeCloud 进行存储、分析和可视化。

```
# 仅用于指标
[OUTPUT]
Name opentelemetry
Alias opentelemetry_metrics
Match *_metrics
Host <host>
Port 443
Metrics_uri /v1/otlp/v1/metrics
Logs_uri /v1/otlp/v1/logs
Traces_uri /v1/otlp/v1/traces
http_User <username>
http_Passwd <password>
Log_response_payload True
Tls On
compress gzip

# 仅用于日志
[OUTPUT]
Name opentelemetry
Alias opentelemetry_logs
Match *_logs
Host <host>
Port 443
Metrics_uri /v1/otlp/v1/metrics
Logs_uri /v1/otlp/v1/logs
Traces_uri /v1/otlp/v1/traces
http_User <username>
http_Passwd <password>
Log_response_payload True
Tls On
compress gzip
Header X-Greptime-Log-Table-Name "<log_table_name>"
Header X-Greptime-Log-Pipeline-Name "<pipeline_name>"
Header X-Greptime-DB-Name "<dbname>"
```

在此示例中,使用 [OpenTelemetry OTLP/HTTP API](https://docs.greptime.com/zh/nightly/user-guide/ingest-data/for-observability/opentelemetry/) 接口。有关更多信息和额外选项,请参阅 [OpenTelemetry](https://docs.greptime.com/zh/nightly/user-guide/ingest-data/for-observability/opentelemetry/) 指南。
Loading