Server able to receive Python logging records via TCP socket connection.
- collects log records from multiple processes or services
- central point to collect logs
- saves records to file in JSON Lines format
- can rotate log files
- can compress log files on rotation and use timestamp in file name
- available as Docker container
- other services (such as Elastic Stack) could pick up log files from this service
Clone repository:
git clone https://github.com/matpackages/logging-receiver.git
cd logging-receiver
Copy example configuration and adjust config.json
according to your needs:
cp example_config.json config.json
Make logs
directory:
mkdir -p logs
Build image and start server:
docker build . -t logging-receiver
docker run --rm -v $PWD/logs:/app/logs -v $PWD/config.json:/app/config.json:ro -p 9000:9000 -it logging-receiver
Create some example logs using example client:
python3 client.py localhost 9000
The logs
directory should get populated with log files.
Source code mostly taken from and inspired by: