This package contains logging handlers and formatters useful for logging to Humio. It’s sole runtime dependency is humiolib.
Runs and tested on Python 3.6, 3.7, 3.8, 3.9.
Contents
Installation
The pacakage on PyPI is named humiologging, same as the package name. Install with for instance pip install humiologging.
Formatters
- humiologging.formatters.HumioKVFormatter
Turns every attribute on the log record into a key-value pair, as suitable for the Humio “kv”-parser. Use with HumioHandler.
- humiologging.formatters.HumioJSONFormatter
Turns the log-record into a json object, as suitable for the Humio “json”-parser. Used by HumioJSONHandler.
Handlers
- humiologging.handlers.HumioHandler
Sends line-based text log messages to Humio. You need to use a formatter that Humio can parse, like HumioKVFormatter.
- humiologging.handlers.HumioJSONHandler
Sends json-formatted log messages to Humio. Does not need a formatter.
Positional arguments:
- humio_host:
The url of the humio ingest host
- ingest_token:
The API token for a Humio repo
Keyword arguments:
- level:
A log-level
- tags:
A dictionary of key value items that will be addded to each record
- add_host_tag:
Whether to automatically add the hostname/ip-address where the loghandler is used as a tag
Be careful with setting many tags, see Humio Documentation: Tagging
Testing
Run automated tests with tox.
To test against humio: you need the hostname of the humio instance and an ingest_token for a repo with parser set to the handler you want to test.
With no parser set
import logging logging.basicConfig(handlers=[HumioJSONHandler(host, token)]) logging.error(‘This is a test’)
In Humio you should get a single entry with one key for every attribute in the log record. One additional key formattedMessage contains the human-readable format set in the logging config as a string.
For parser kv
import logging logging.basicConfig(handlers=[HumioHandler(host, token).setFormatter(HumioKVFormatter())]) logging.error(‘This is a test’)
In Humio you should get a single record with a string containing many key=value pairs. One additional key formattedMessage contains the human-readable format set in the logging config as a string.
Metadata
Release files for humiologging 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| humiologging-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Release files / humiologging-1.0.4-py3-none-any.whl
| Download URL | humiologging-1.0.4-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc23f4072840df6126695ba7b83f0296004d134e6613687af70258b9d14e9a5d
|
|
BLAKE2b-256 checksum How to use checksums |
17adafab9fb8a6ea9e033260b4a7b87107d3e1b37d2df86f183614fe921e78cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.12
|
Security for humiologging 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.