Better Stack collector is the easiest and the recommended way to send logs, metrics and traces from your Docker hosts to Better Stack. Install it with one command on a single host or across a Docker Swarm cluster.
The collector runs with Docker Compose 1.25.0 or later.
eBPF tracing is enabled by default. For this full tracing setup, keep 4 GiB of memory and 4 vCPUs available on each host. If you disable eBPF tracing, keep 2 GiB of memory and 2 vCPUs available per host.
eBPF tracing needs Linux kernel 5.14 or newer. Check that your host supports it:
Check failed? See eBPF requirements.
Deploy collector with the provided install script:
Then restart your services so the eBPF instrumenters can attach correctly.
Rerun the install command to upgrade collector:
Something wrong? Let us know at hello@betterstack.com.
Deploy collector to each node in your Swarm cluster using the following script:
Then restart your services so the eBPF instrumenters can attach correctly.
To restrict the Collector to selected Swarm nodes, add the better-stack.collector=true label to those nodes from a swarm manager. Nodes without the label will stop running the Collector.
Rerun the deploy command to upgrade collector:
Getting container name is already in use? Force the upgrade. It removes the existing collector containers before upgrading collector:
Attach container labels to your logs with Docker's json-file log driver. List the label keys to attach in /etc/docker/daemon.json:
Then apply the change:
Restart the Docker daemon at a time your services can be briefly unavailable:
Recreate your containers. Docker applies log options only to containers created after the restart.
The labels show up on logs in the attrs object.
Send any log files from the host filesystem to Better Stack. For example, add the following configuration to your manual.vector.yaml file to send the logs from /var/www/custom.log and any file matching /var/www/**/service.*.log:
Any source with a name starting with better_stack_logs_ is forwarded to the logs sink.
Collector mounts the root filesystem read-only into the collector container by default. You can mount only select paths into the container:
Selected paths will be mounted read-only under the /host prefix, e.g. /host/var/www/custom.
The ebpf container requires privileged access as it runs the eBPF code responsible for generating traces. The collector container doesn't request privileged access.
Please let us know at hello@betterstack.com.
We're happy to help! 🙏
We use cookies to authenticate users, improve the product user experience, and for personalized ads. Learn more.