k-space
/
mongo-logger
Archived
9
0
Fork 0
Docker Fluent logging driver compatible piece for submitting Docker logs to Mongo
This repository has been archived on 2023-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Madis Mägi b7b36548f4
gitea-kspace/mongo-logger/pipeline/head This commit looks good Details
Add Jenkinsfile
2021-10-17 10:34:30 +03:00
.flake8 Formatting fixes 2021-07-05 15:44:44 +03:00
.gitignore Add missing bits 2021-06-30 14:41:07 +00:00
.pre-commit-config.yaml Formatting fixes 2021-07-05 15:44:44 +03:00
Dockerfile Initial commit 2021-06-19 18:43:37 +00:00
Jenkinsfile Add Jenkinsfile 2021-10-17 10:34:30 +03:00
README.md Fix link in README 2021-07-05 15:45:38 +03:00
docker-compose.yml Add missing bits 2021-06-30 14:41:07 +00:00
logger.py Formatting fixes 2021-07-05 15:44:44 +03:00
overnode.yml Add missing bits 2021-06-30 14:41:07 +00:00
tailer.py Formatting fixes 2021-07-05 15:44:44 +03:00

README.md

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 here