A light-weight socket log receiver
Project description
Socket Log Receiver
socket_log_receiver
is a light-weight socket log receiving server.
It aggregates messages from multi-process application via socket and
logs to a single file. The service is intended to be used with
Python's logging
package, which does not support multi-process
writes to a single file.
Installation
$ pip install socket-log-receiver
Basic Usage
The receiver service should be run as a service:
$ python -m socket_log_receiver # as a module
$ log_receiver # as a command-line program
By default, the receiver service starts listening on localhost:9020
.
In the application, use SocketHandler
to send logs to the receiver
service.
from logging.handlers import SocketHandler
handler = SocketHandler('localhost', 9020) # handler to send logs to localhost:9020
logging.root.addHandler(handler) # add the socket handler to the root logger
This way, the root logger sends logging messages to the receiver service.
Undefined Signal
The receiver service's configuration is managed by
resconfig. By default, the
dynamic configuration update is trigged by SIGHUP
. Some systems
might not make this signal available, in which case you could use a
different signal for the trigger using the command-line option, e.g.
$ log_receiver --reload-signal SIGUSR2
Development
$ pip install -e .[dev]
$ pre-commit install
Running Tests
$ pip install -e .[test]
$ pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file socket-log-receiver-24.2.0a0.tar.gz
.
File metadata
- Download URL: socket-log-receiver-24.2.0a0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7ef49746e220407fe37202922fcab93794df53dcf99a9432c28b05482e7f496 |
|
MD5 | cdb894a3c375e591d53921d511d7df27 |
|
BLAKE2b-256 | a7f9ecfcc92e8dd29934328b31ab405ef5040e3dba3142cfc15637dcedaa303c |
File details
Details for the file socket_log_receiver-24.2.0a0-py3-none-any.whl
.
File metadata
- Download URL: socket_log_receiver-24.2.0a0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4f0f62b042eea1e4ba92a165f0b92a75cf8b5c7b18e992b078add5a51c8270e |
|
MD5 | 3c0962c50681bf5ec479cdceb855ffab |
|
BLAKE2b-256 | db85691f0f96b0ec9e7611e908d154f5ce58428a7051dd436d5280bcb5847ec6 |