Container running fluent-bit to parse and send logs to OpenSearch.
- Read docker-compose.yaml and config/fluent-bit.conf
- Ensure that openseach is running
- Start fluent-bit :
docker compose up -d
- Configure logging driver to use either journald or fluentd driver
# journald for a given container
docker run --log-driver=journald --rm --name test_fluent -t ubuntu echo "Testing a raw log message"
docker run --log-driver=journald --rm --name test_fluent -t ubuntu echo '{"content":"Testing a JSON log message","label":"meuh"}'
docker run --log-driver=journald --rm --name test_fluent -t ubuntu echo '{"content":"Testing a JSON \r\n multiple line \r\n log message","label":"meuh"}'
# fluentd for a given container
docker run --log-driver=fluentd --rm --name test_fluent -t ubuntu echo '{"content":"Testing a JSON log message","label":"meuh"}'
- Note that you may also configure globally docker to log using journald in
/etc/docker/daemon.json
:
{
"log-driver": "journald"
}
(systemctl daemon-reload && systemctl restart docker
)