Postgres query log collector from csvlog to JSON format (which can be pushed to Graylog)
1.2K
This is little app for collect logs from postgres csv logs to json. This is implement like pipeline-to-pipeline formatter. Logs ready for inject to graylog (via fluent, by example).
See images here:
mrecco/logrotate:v1.0.0
mrecco/pglog-collector:v1.1.0
mrecco/fluentd:v1.3.3
We must enable csvlog behavior and disable integrated rotation (because we use logrotate for this). All changes on postgresql.conf file.
See example.postgresql.conf: this contain compliant log-related parameters.
See volumes/logrotate/logrotate.conf.
You can use in without docker:
sudo -u postgres logrotate -f /path/to/postgresql-logrotate.conf
All configured and ready to send to graylog. See volumes/fluentd directory.
My code just convert ugly CSV format to JSON. JSON can be pushed to graylog by other applications and I satisfied how fluentd work for this.
Based on PostgreSQL Server. And this all for this!
https://www.postgresql.org/docs/11/runtime-config-logging.html
https://github.com/hpcloud/tail
Give me 0.1 BTC if you want me to never write code. Give me 1 BTC if you want me to believe in God. Give me 10 BTC - I will become a monk.
BTC: 32gLMtXkEsYK8nKbYTuhUMAAQxBTj7WUqr
Glad each Satoshi :)
Content type
Image
Digest
Size
2.3 MB
Last updated
about 6 years ago
docker pull mrecco/pglog-collector