My lab for developing a Fluent Forward exporter in Opentelemetry-Collector.
Official documentation: Building a custom collector.
Clone the repo and the submodule
git clone --recurse-submodules git@github.com:r0mdau/otelcol-dev.git
Run a Fluent Bit instance that will receive messages over TCP port 24224 through the fluent-forward protocol and send the messages to stdout interface in JSON format every second
docker run --name fluent --rm -p 127.0.0.1:24224:24224 fluent/fluent-bit /fluent-bit/bin/fluent-bit -i forward -o stdout -p format=json_lines -f 1
Build the custom collector
make build
Start the collector
./build/otelcol-dev --config testdata/config.yaml
Generate 100 log lines
bash scripts/generate-logs.sh 100 >> testdata/access.log
Look at Fluentbit logs
docker logs fluent
A replace instruction is set to use local code in the go.mod
file: replace github.com/r0mdau/fluentforwardexporter => ./fluentforwardexporter
.
Add the module to the good factory map in the components.go
file.
How-to generate the otelcol-dev
content the first time (doc)
ocb --config scripts/builder-config.yaml