55 lines
995 B
Markdown
55 lines
995 B
Markdown
# Mongo logger
|
|
|
|
This is Mongo backed logging system that makes use of the `fluentd` driver found in Docker.
|
|
|
|
|
|
# Running in production
|
|
|
|
To collect container logs on a Docker host
|
|
populate `.env` with `MONGO_URI` and
|
|
deploy `docker-compose.yml` on all Docker hosts.
|
|
|
|
In Docker host adjust `/etc/docker/daemon.json`
|
|
|
|
```
|
|
{
|
|
"log-driver": "fluentd",
|
|
"log-opts": {
|
|
"fluentd-address": "127.0.0.1:24224",
|
|
"fluentd-sub-second-precision": true
|
|
}
|
|
}
|
|
```
|
|
|
|
Proceed to reload Docker daemon.
|
|
|
|
Enable syslog forwarding:
|
|
|
|
```
|
|
echo '*.* @127.0.0.1:5140' | tee /etc/rsyslog.d/fwd.conf
|
|
systemctl restart rsyslog
|
|
```
|
|
|
|
|
|
# Dumping logs
|
|
|
|
To dump logs on console:
|
|
|
|
```
|
|
pip3 install motor termcolor
|
|
source .env
|
|
export MONGO_URI
|
|
python3 tailer.py
|
|
```
|
|
|
|
|
|
# Why not Loki?
|
|
|
|
Loki is ridiculously complex to set up for HA setup.
|
|
|
|
|
|
# Why not Fluentd?
|
|
|
|
After spending great deal of time working around bugs and design flaws in Fluentd
|
|
we gave up. For reasoning see [https://github.com/fluent/fluentd/pull/2808](here)
|