Fluent Bit
Fluent Bit collects, parses, and forwards logs. The Doris output plugin sends batches to a VeloDB Cloud warehouse through Stream Load. You run Fluent Bit in the environment that contains the application logs.
Note:
The original integration uses an alpha Doris output build from a personal fork. The examples below describe that build's configuration. Before using it with a warehouse, verify its support for the endpoint, required TLS settings, redirects, authentication, and retry behavior. For a new deployment, start with the OpenTelemetry integration or DOG Stack Quick Start.
Prerequisites
- A running VeloDB Cloud warehouse and a warehouse SQL user with
INSERTpermission on the target tables. Create the tables first using a user with the required database and table creation privileges. - A machine where you can run Fluent Bit and read the application log files.
- Network access from that machine to the warehouse. In the console, select the warehouse, open Connect, and copy the StreamLoad Endpoint connection details. Use the generated host, port, and TLS requirements for your SaaS or BYOC deployment. See Connection Methods.
- A reviewed Fluent Bit build that includes the
dorisoutput plugin and supports that connection path. A standard Fluent Bit installation must not be assumed to include the alpha plugin.
The templates use STREAM_LOAD_HOST, STREAM_LOAD_PORT, WAREHOUSE_USER, and WAREHOUSE_PASSWORD environment variables. Set them from your warehouse connection details and secret store. Do not include a protocol or URL path in host. The templates show plugin fields from the alpha integration, so they do not supply unverified TLS settings. If that build cannot meet your warehouse's TLS requirements, use the OpenTelemetry integration instead.
Alpha build provenance
The upstream integration references the Doris output development fork and a historical Fluent Bit Doris 3.1.9 alpha binary. These are upstream evaluation artifacts, rather than a VeloDB Cloud release or an upstream Fluent Bit release.
If you evaluate the source build, review and pin the source revision and its dependencies first. From the source tree's build/ directory, the original build instructions are:
cmake -DFLB_RELEASE=ON ..
make
The resulting executable is build/bin/fluent-bit. Confirm that it exposes the doris output and the transport settings required by your deployment before proceeding.
Doris output parameters
The alpha integration documents the following parameters. Confirm defaults against the build you use:
| Configuration | Description |
|---|---|
host | Host from the warehouse's Stream Load connection details. |
port | Port for that Stream Load endpoint. |
user | Warehouse SQL user with INSERT permission on the target table. |
password | Password for the warehouse SQL user. Supply it through a protected environment variable. |
database | Target SQL database. |
table | Target table. |
label_prefix | Stream Load label prefix. Labels use {label_prefix}_{timestamp}_{uuid}. The documented default is fluentbit. Set to false to omit the label. |
time_key | Field added for the collection timestamp. The documented default is date. Set to false to omit it. |
header | Stream Load headers. Repeat the option to supply multiple headers. |
log_request | Log request and response metadata for troubleshooting. The documented default is true. Review logs for sensitive information. |
log_progress_interval | Interval in seconds for throughput logs. The documented default is 10. Set to 0 to disable them. |
retry_limit | Retry count after a failed request. The documented default is 1. false allows unlimited retries. |
workers | Concurrent output workers. The documented default is 2. |
A request label alone does not establish end-to-end exactly-once delivery. Test retries and restart recovery with your chosen build and input configuration.
Examples
The examples use unpartitioned demo tables so historical sample timestamps remain loadable. For production data, configure partitioning and retention deliberately. A relative dynamic-partition window can reject historical samples that fall outside its active partitions.
Example 1: Collect multiline application logs
Parse Java application logs and preserve stack traces
This example collects logs from an application that you manage. Managed VeloDB Cloud FE and BE host logs are not a prerequisite.
1. Prepare the source log
Save the following synthetic sample as application.log on the Fluent Bit machine:
2024-07-08 21:18:01,432 INFO (order-worker|61) [OrderService.process():70] Order 10001 is ready to ship
2024-07-08 21:18:53,710 WARN (order-worker|208) [OrderService.ship():333] Shipment attempt failed
com.example.fulfillment.ShipmentException: carrier temporarily unavailable
at com.example.fulfillment.OrderService.ship(OrderService.java:333)
at com.example.fulfillment.OrderWorker.run(OrderWorker.java:70)
2. Create the target table
Run this SQL in SQL Editor. The schema stores the event time, collection time, source host and path, parsed fields, and message:
CREATE DATABASE IF NOT EXISTS fluentbit_demo;
USE fluentbit_demo;
CREATE TABLE `application_logs` (
`log_time` datetime NULL COMMENT 'log content time',
`collect_time` datetime NULL COMMENT 'log agent collect time',
`host` text NULL COMMENT 'hostname or ip',
`path` text NULL COMMENT 'log file path',
`level` text NULL COMMENT 'log level',
`thread` text NULL COMMENT 'log thread',
`position` text NULL COMMENT 'log code position',
`message` text NULL COMMENT 'log message',
INDEX idx_host (`host`) USING INVERTED COMMENT '',
INDEX idx_path (`path`) USING INVERTED COMMENT '',
INDEX idx_level (`level`) USING INVERTED COMMENT '',
INDEX idx_thread (`thread`) USING INVERTED COMMENT '',
INDEX idx_position (`position`) USING INVERTED COMMENT '',
INDEX idx_message (`message`) USING INVERTED PROPERTIES("parser" = "unicode", "support_phrase" = "true") COMMENT ''
) ENGINE=OLAP
DUPLICATE KEY(`log_time`)
COMMENT 'OLAP'
DISTRIBUTED BY RANDOM BUCKETS 10;
The demo retains event time to whole seconds. Add a timestamp conversion if your production schema needs millisecond precision.
3. Configure the input, parser, and output
Save application_logs.conf and parsers.conf in the same directory. Replace /absolute/path/to/application.log with your input path and /absolute/path/to/application-tail.db with a writable checkpoint path. The checkpoint lets the tail input track its position across restarts.
application_logs.conf:
# config for Fluent Bit service
[SERVICE]
log_level info
# parsers file
parsers_file parsers.conf
# use input tail
[INPUT]
name tail
path /absolute/path/to/application.log
read_from_head true
db /absolute/path/to/application-tail.db
# add log file name to the record, key is 'path'
path_key path
# set multiline parser
multiline.parser multiline_java
# parse log
[FILTER]
match *
name parser
key_name log
parser java_log
reserve_data true
# add host info
[FILTER]
name sysinfo
match *
# add hostname to the record, key is 'host'
hostname_key host
# Send batches to the warehouse.
[OUTPUT]
name doris
match *
host ${STREAM_LOAD_HOST}
port ${STREAM_LOAD_PORT}
user ${WAREHOUSE_USER}
password ${WAREHOUSE_PASSWORD}
database fluentbit_demo
table application_logs
# add 'collect_time' to the record
time_key collect_time
# Convert the collection timestamp to DATETIME.
header columns collect_time=from_unixtime(collect_time)
log_request true
log_progress_interval 10
parsers.conf:
[MULTILINE_PARSER]
name multiline_java
type regex
flush_timeout 1000
# Regex rules for multiline parsing
# ---------------------------------
#
# configuration hints:
#
# - first state always has the name: start_state
# - every field in the rule must be inside double quotes
#
# rules | state name | regex pattern | next state name
# --------|----------------|---------------|-----------------
rule "start_state" "/(^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2})(.*)/" "cont"
rule "cont" "/(^(?![0-9]{4}-[0-9]{2}-[0-9]{2}))(.*)/" "cont"
[PARSER]
name java_log
format regex
# parse and add 'log_time', 'level', 'thread', 'position', 'message' to the record
regex ^(?<log_time>[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}),[0-9]{3} (?<level>[^ ]+) \((?<thread>[^\)]+)\) \[(?<position>[^\]]+)\] (?<message>(\n|.)*)$
4. Start and verify ingestion
Run from the configuration directory:
fluent-bit -c application_logs.conf
Inspect the Stream Load response. Check the JSON Status, NumberLoadedRows, and NumberFilteredRows fields, rather than relying only on HTTP status 200.
In SQL Editor, query the target:
SELECT log_time, level, thread, position, message
FROM fluentbit_demo.application_logs
ORDER BY log_time;
For a fresh demo table and checkpoint, the sample produces two records. The warning record's message should contain both the main message and its stack trace. If you rerun after deleting the tail checkpoint, Duplicate Key tables can retain another copy of the same input records.
Example 2: Collect JSON events
Load newline-delimited GitHub event records
1. Prepare the source data
The GH Archive project publishes GitHub event archives as newline-delimited JSON. Download and extract an archive on the Fluent Bit machine:
curl --fail --location --output github-events.json.gz https://data.gharchive.org/2024-01-01-15.json.gz
gzip --decompress github-events.json.gz
Each line must contain one complete JSON event. The event shape includes scalar fields such as id, type, created_at, and public, and nested actor, repo, and payload objects.
2. Create the target table
Run this SQL in SQL Editor:
CREATE DATABASE IF NOT EXISTS fluentbit_demo;
USE fluentbit_demo;
CREATE TABLE github_events (
created_at DATETIME,
id BIGINT,
type TEXT,
public BOOLEAN,
actor VARIANT,
repo VARIANT,
payload VARIANT,
INDEX idx_id (id) USING INVERTED,
INDEX idx_type (type) USING INVERTED,
INDEX idx_actor (actor) USING INVERTED,
INDEX idx_repo (repo) USING INVERTED
)
DUPLICATE KEY(created_at)
DISTRIBUTED BY RANDOM BUCKETS 10;
The unpartitioned demo table accepts the archive's historical dates. The nested fields use VARIANT to retain the JSON structure.
3. Configure the JSON input and output
Save github_events.conf and github_parsers.conf in the same directory. Replace both absolute paths with paths on your machine:
[SERVICE]
log_level info
parsers_file github_parsers.conf
[INPUT]
name tail
parser github
path /absolute/path/to/github-events.json
read_from_head true
db /absolute/path/to/github-tail.db
[OUTPUT]
name doris
match *
host ${STREAM_LOAD_HOST}
port ${STREAM_LOAD_PORT}
user ${WAREHOUSE_USER}
password ${WAREHOUSE_PASSWORD}
database fluentbit_demo
table github_events
time_key false
log_request true
log_progress_interval 10
github_parsers.conf:
[PARSER]
name github
format json
4. Start and verify ingestion
fluent-bit -c github_events.conf
Verify loaded rows in SQL Editor:
SELECT type, COUNT(*) AS event_count
FROM fluentbit_demo.github_events
GROUP BY type
ORDER BY event_count DESC;
The result depends on the archive you selected and how much data has been ingested. Inspect Stream Load responses for rejected rows before treating the result as complete.
Common errors
| Symptom | What to check |
|---|---|
Fluent Bit cannot find the doris output | The binary must include the alpha output plugin. Confirm the build provenance and available plugins. |
| Connection, redirect, or TLS errors | Compare the plugin's transport support with the generated Stream Load connection details. Confirm access to every required host and port. Use OpenTelemetry if the alpha build cannot use that connection path. |
HTTP 200 but no loaded rows | Inspect the Stream Load JSON response for the actual load status, filtered rows, and the error details. |
| No input records | Confirm the file path, read permission, read_from_head, and saved tail checkpoint. |
| Timestamp or schema errors | Confirm the parser output, target column types, and Stream Load column mappings. For partitioned production tables, verify that the event date has an active partition. |
| Duplicate rows after restarting | Check the tail checkpoint and retry behavior. Duplicate Key tables preserve duplicates. |
Cost and cleanup
Fluent Bit consumes resources in your environment. Warehouse ingestion, query compute, stored data, and data transfer can incur charges. See Billing.
Stop Fluent Bit before removing demo resources. If fluentbit_demo contains only these examples, remove it in SQL Editor:
DROP DATABASE fluentbit_demo;
Delete the downloaded archive, demo configuration files, and tail checkpoints when they are no longer needed. Remove demo credentials from the environment. Plan retention before collecting continuous production logs.