logzio-structlog-handler
Handler to send structlog logger to logzio
All logs have host, pid and tid added to them.
Example of log created with handler:
logger.info(
"request_finished",
request=f"{METHOD} {ENDPOINT}",
code=response.status_code,
request_id=uuid4()
)
Logzio:
"_source": {
"request": "GET /account/ping",
"code": 200,
"level": "info",
"logger": "django_structlog.middlewares.request",
"ip": "127.0.0.1",
"log_level": "INFO",
"pid": 1,
"type": "http-bulk",
"message": "request_finished FOR GET /account/ping",
"tid": [
140649178957632
],
"tags": [
"_logz_http_bulk_json_8070"
],
"@timestamp": "2022-01-10T19:34:19.932Z",
"line_number": 71,
"host": "name-of-host",
"event": "request_finished",
"request_id": "3777349e-0247-4c89-ace2-ea2174930f39",
"path_name": "path/to/file.py",
"timestamp": "2022-01-10T19:34:19.931955Z",
"random_tag_1": "some_value",
"random_tag_2": 123
}
Instructions:
- Install
❯ pip install logzio-structlog-handler
- Add the following handler to you LOGGING file:
LOGGING = {
"handlers": {
"logzio": {
"class": "structlogzio.LogzIoStructlogHandler",
"level": "INFO",
"token": "YOUR_TOKEN",
"logs_drain_timeout": 5,
"url": "https://listener.logz.io:8071",
"network_timeout": 10,
# accepts any Dict[str, Any] value and passes it to all logs
"tags": {"random_tag_1": "some_value", "random_tag_2": 123},
}
},
"loggers": {
"": {"level": "INFO", "handlers": ["logzio"], "propagate": True},
},
}
Metadata
Release files for logzio-structlog-handler 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| logzio-structlog-handler-0.1.1.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| logzio_structlog_handler-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.3 kB
Release files / logzio-structlog-handler-0.1.1.tar.gz
| Download URL | logzio-structlog-handler-0.1.1.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77b4cba51e4cdf85ede96fb02da697c79b22bfa77085eb564b9c081a575b16cb
|
|
BLAKE2b-256 checksum How to use checksums |
d88c5c36dd177b057ba251bd324360cf7db8c29fece00db6a069806d8d85dec7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.8.10 Linux/5.4.0-92-generic
|
Release files / logzio_structlog_handler-0.1.1-py3-none-any.whl
| Download URL | logzio_structlog_handler-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc5a287947f966e7564ae6495ef92be219e75ec8f312d376674d8b4d337033fc
|
|
BLAKE2b-256 checksum How to use checksums |
5946e61c853d5ed070bd9f604bdf2f0e10d005973276f668505a855313cb2aa9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.8.10 Linux/5.4.0-92-generic
|