Filebeat
Use the Beats Doris output plugin to send application logs to a VeloDB Cloud warehouse through Stream Load. The plugin supports batching, retries, and custom Stream Load headers.
The plugin must be compiled into the Beats binary. Installing a standard Filebeat distribution does not add output.doris. The source includes entry points for Filebeat, Metricbeat, Packetbeat, Winlogbeat, Auditbeat, and Heartbeat. This guide uses Filebeat.
Prerequisites
- A running SaaS or BYOC warehouse and a warehouse SQL user with load privileges on the target tables. You also need permission to create the sample database and tables.
- Network access from Filebeat to the warehouse's Stream Load endpoint, including any additional ingestion ports required by your connection method. Copy the endpoint from Connect in the console. See Connection Methods.
- Read access to application log files on a host that you operate. These examples do not require access to managed warehouse FE or BE logs.
- A Filebeat build containing the Doris output plugin. Match the input and processor configuration to that build's Beats version. The examples below use the legacy
loginput provided by the plugin's Beats 7 source.
Use the endpoint's required protocol and TLS settings. For HTTPS, the Filebeat host must trust the endpoint's certificate. Do not disable certificate verification to work around a connection failure.
Build the plugin-enabled binary
Use the Apache Doris Beats extension source. Check out the release or revision you intend to use before building, and use its required Go toolchain:
git clone https://github.com/apache/doris.git
cd doris
# Replace <doris-ref> with the release tag or revision you selected.
git checkout <doris-ref>
cd extension/beats
go build -o filebeat-doris filebeat/filebeat.go
For another Beat, build its corresponding entry point, such as metricbeat/metricbeat.go. A successful build confirms compilation, not compatibility with every warehouse endpoint or log format. Test a small batch before enabling continuous collection.
Output configuration
| Parameter | Meaning |
|---|---|
http_hosts | Array of Stream Load base URLs, including the protocol and port, without /api/.../_stream_load. Use the warehouse endpoint rather than self-managed FE addresses. |
fenodes | Legacy alias for the endpoint array. If both keys are configured, http_hosts takes precedence. Use one key consistently. |
user, password | Warehouse SQL credentials with load privileges on the target table. |
database, table | Target database and table. Create them before starting collection. |
label_prefix | Prefix for generated Stream Load labels. The default is beats. |
headers | YAML map of Stream Load headers, such as format and read_json_by_line. |
codec_format_string | Output template. %{[message]} sends the original message. Serialize structured content as valid JSON before using a template. |
bulk_max_size | Maximum events in a batch. The source default is 100000. Tune it with queue capacity, event size, and latency requirements. |
max_retries | Retry count. The source default is -1, which retries indefinitely. Retries alone do not guarantee delivery through a process or host failure. |
log_request | Whether to log Stream Load request and response details. The source default is true. Review logs for sensitive metadata before sharing them. |
log_progress_interval | Progress logging interval in seconds. The source default is 10. Set it to 0 to disable progress logging. |
Defaults can differ between plugin revisions. Review the configuration for the binary you deploy.
In the examples, replace the endpoint and file path, and provide WAREHOUSE_SQL_USER and WAREHOUSE_SQL_PASSWORD through the Filebeat keystore or your process environment. For keystore setup, see the Filebeat secrets keystore documentation. Keep passwords out of configuration files committed to source control.
Example 1: Collect multiline text logs
Parse a Java application log and preserve stack traces
Create the target table
Run this SQL in the warehouse's SQL Editor:
CREATE DATABASE IF NOT EXISTS log_db;
USE log_db;
CREATE TABLE doris_log (
log_time DATETIME(3),
collect_time DATETIME(3),
host TEXT,
path TEXT,
level TEXT,
thread TEXT,
position TEXT,
message TEXT,
INDEX idx_level (level) USING INVERTED,
INDEX idx_message (message) USING INVERTED
PROPERTIES("parser" = "unicode", "support_phrase" = "true")
)
DUPLICATE KEY(log_time)
DISTRIBUTED BY RANDOM BUCKETS 4;
This small demonstration table is unpartitioned so that you can replay the historical sample below. It does not expire rows automatically. For continuous ingestion, design time partitions and retention for your workload. See Store and Analyze Logs.
Prepare the source log
Save these synthetic application records in a file that Filebeat can read:
2024-07-08 21:18:01,432 INFO (worker|61) [OrderService.process():70] Order received
2024-07-08 21:18:53,710 WARN (worker|62) [OrderService.process():84] Payment service unavailable
java.lang.IllegalStateException: Retry payment
at example.OrderService.process(OrderService.java:84)
The multiline input combines the exception and stack trace with the preceding timestamped record. The timestamp in this sample has no UTC offset. Interpret it consistently with the warehouse session and dashboard time zone.
Configure Filebeat
Save the following as filebeat_doris_log.yml. Replace /absolute/path/to/app.log with your source file and the HTTPS URL with the warehouse Stream Load base URL.
filebeat.inputs:
- type: log
enabled: true
paths:
- /absolute/path/to/app.log
multiline:
type: pattern
pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}'
negate: true
match: after
processors:
- dissect:
tokenizer: '%{day} %{time} %{level} (%{thread}) [%{position}] %{content}'
target_prefix: ''
ignore_failure: true
- script:
lang: javascript
source: >
function process(event) {
var record = {
log_time: event.Get('day') + ' ' + event.Get('time').replace(',', '.'),
collect_time: event.Get('@timestamp'),
host: event.Get('agent.hostname'),
path: event.Get('log.file.path'),
level: event.Get('level'),
thread: event.Get('thread'),
position: event.Get('position'),
message: event.Get('message')
};
event.Put('@metadata.doris_json', JSON.stringify(record));
}
queue.mem:
events: 4096
flush.min_events: 512
flush.timeout: 5s
output.doris:
http_hosts: ['https://<warehouse-host>:<https-port>']
user: '${WAREHOUSE_SQL_USER}'
password: '${WAREHOUSE_SQL_PASSWORD}'
database: log_db
table: doris_log
bulk_max_size: 512
codec_format_string: '%{[@metadata.doris_json]}'
headers:
format: json
read_json_by_line: 'true'
JSON.stringify() escapes quotation marks, tabs, and newlines in messages. Interpolating raw log text inside a JSON string can produce invalid JSON. Adjust the parser for your application format before collecting other files. In particular, a timestamped line that does not match the dissect pattern needs a fallback or a separate pipeline.
The queue and batch values are starting values for this small example. A memory queue is not durable. Review persistent queue options and retry behavior for production use.
Start and verify collection
./filebeat-doris test config -c filebeat_doris_log.yml
./filebeat-doris -e -c filebeat_doris_log.yml
Inspect the Stream Load response. Successful loads report Status: Success and no filtered rows. Then query the table:
SELECT log_time, level, message
FROM log_db.doris_log
ORDER BY log_time DESC
LIMIT 10;
The two timestamped records should appear, with the exception attached to the warning record. The file input tracks offsets, so restarting Filebeat does not necessarily replay lines that were already read.
Example 2: Collect JSON logs
Load newline-delimited JSON without reparsing each event
Create the target table
For existing newline-delimited JSON logs, send the raw message to Stream Load. This example keeps changing nested attributes in VARIANT columns:
CREATE DATABASE IF NOT EXISTS log_db;
USE log_db;
CREATE TABLE github_events (
created_at DATETIME,
id BIGINT,
type TEXT,
public BOOLEAN,
actor VARIANT,
repo VARIANT,
payload VARIANT,
INDEX idx_type (type) USING INVERTED
)
DUPLICATE KEY(created_at)
DISTRIBUTED BY RANDOM BUCKETS 4;
The table is unpartitioned for historical sample replay. Configure retention before using it for continuous ingestion.
Prepare JSON data
Save this synthetic record on a single line in a local file:
{"created_at":"2024-01-01T15:00:00Z","id":1,"type":"PushEvent","public":true,"actor":{"login":"example-user"},"repo":{"name":"example/project"},"payload":{"size":1}}
For a larger public dataset, download an hourly file from GH Archive and decompress it before configuring the file input. Create partitions covering the archived timestamps if you use a partitioned target table.
Configure and start Filebeat
Save the following as filebeat_github_events.yml, replacing the file path and endpoint:
filebeat.inputs:
- type: log
enabled: true
paths:
- /absolute/path/to/events.json
queue.mem:
events: 4096
flush.min_events: 512
flush.timeout: 5s
output.doris:
http_hosts: ['https://<warehouse-host>:<https-port>']
user: '${WAREHOUSE_SQL_USER}'
password: '${WAREHOUSE_SQL_PASSWORD}'
database: log_db
table: github_events
bulk_max_size: 512
codec_format_string: '%{[message]}'
headers:
format: json
read_json_by_line: 'true'
./filebeat-doris test config -c filebeat_github_events.yml
./filebeat-doris -e -c filebeat_github_events.yml
Verify the loaded fields:
SELECT id, type, actor['login'], repo['name']
FROM log_db.github_events
ORDER BY created_at DESC
LIMIT 10;
Common errors
| Symptom | Cause and resolution |
|---|---|
output.doris is unknown | The binary does not contain the Doris output. Use the plugin-enabled build. |
| Configuration parsing fails | Check YAML indentation, environment or keystore values, and compatibility with your Beats version. Use -c to select the configuration file. |
| Connection or TLS errors | Check the warehouse URL, DNS, routing, required ingestion ports, and certificate trust from the Filebeat host. |
| Rows are filtered | Inspect the load response and error details. Check JSON escaping, field names, timestamp formats, and partition coverage. |
| No rows are read from a file | Check file permissions and Filebeat's saved offsets. Append a new test record rather than resetting production offsets. |
| Retries or queue growth continue | Check authentication, privileges, and load errors before increasing batch size. Monitor the source and collector for backpressure. |
Cost and cleanup
Continuous collection consumes warehouse storage and compute, and network transfer can incur charges. See Billing. Stop the test Filebeat process when finished. Drop only the sample tables that you created and no longer need:
DROP TABLE log_db.doris_log;
DROP TABLE log_db.github_events;
Stopping Filebeat does not delete warehouse data. Keep production tables and Filebeat registry files intact.