Fluent Bit deployment
- Developer Preview
Fluent Bit is the recommended way to forward logs to CMOS from Couchbase Server instances.
Kubernetes usage
Couchbase Autonomous Operator (CAO) versions 2.2 and greater already support Fluent Bit log forwarding. Refer to the CAO documentation for the full details.
The main configuration required is providing the CMOS Loki endpoint as part of the Couchbase cluster configuration. To do this, use Couchbase Fluent Bit versions 1.1.2 or greater and supply the following annotations with appropriate values.
pod:
metadata:
annotations:
# Match all logs
fluentbit.couchbase.com/loki_match: "*"
# Send to this SVC
fluentbit.couchbase.com/loki_host: loki.default
A full example of integrating is available as part of the Kubernetes example.
On-premise usage
Fluent Bit already provides various supported targets so on-premise installation is straight forward. For full details, please refer to the official documentation.
For CMOS needs we must do the following:
-
Install Fluent Bit.
-
Configure Fluent Bit.
Step one is deploying the Fluent Bit binary with Couchbase Server and providing a startup script to launch it. Refer to the installation instructions above from Fluent Bit for this.
Step two is configuring fluent bit with the configuration provided by the official Couchbase Fluent Bit image. You can either clone the repository or just copy over the configuration file. The key is to get all the configuration into the expected location for the local Fluent Bit to use, refer to the deployment guide from Fluent Bit for full details for the specific targets. Whilst this is intended primarily for CAO deployments and not officially supported on-premise, it will function there as well.
$ git clone --depth 1 https://github.com/couchbase/couchbase-fluent-bit.git
$ cp -R conf/* <config directory for Fluent Bit on this OS>
Container deployment
A simplified solution would be to deploy the container solution explicitly with local volume mounts for the Couchbase Server logs. An existing example and blog post is available in the Couchbase Fluent Bit repository to show a complete stack.
$ docker run --rm -d --name logger -v /opt/couchbase/var/lib/couchbase/logs/:/opt/couchbase/var/lib/couchbase/logs/:ro -e COUCHBASE_LOGS=/opt/couchbase/var/lib/couchbase/logs/ -e LOKI_MATCH="*" -e LOKI_HOST="127.0.0.1" couchbase/fluent-bit:1.1.3
Replace LOKI_HOST
here with your actual DNS name or IP address for CMOS.
Loki configuration for Fluent Bit
Similar to the Kubernetes set up, make sure to set the environment variables to the appropriate values when Fluent Bit is launched.
Variable name | Description |
---|---|
LOKI_HOST |
The (resolvable) hostname to send the logs to, i.e. where CMOS is running or another Loki stack if you want to integrate with that. |
LOKI_PORT |
The port open on |
LOKI_MATCH |
The set of logs to match to send to Loki, this can be a wildcard or specific logs in the format |
In addition to the above Loki specific configuration make sure to set the environment variables Fluent Bit requires. |