sag_py_logging_logstash
Python Logstash Async is an asynchronous Python logging handler to submit log events to a remote Logstash instance. It based on open source library, see the documentation http://python-logstash-async.readthedocs.io/en/latest/. In this version transporter is limited to HTTPTransport, according to Logstash intern installation requirements.
Unlike most other Python Logstash logging handlers, this package works asynchronously by collecting log events from Python's logging subsystem and then transmitting the collected events in a separate worker thread to Logstash. This way, the main application (or thread) where the log event occurred, doesn't need to wait until the submission to the remote Logstash instance succeeded.
This is especially useful for applications like websites or web services or any kind of request serving API where response times matter.
Usage
Example::
from logstash_async.handler import AsynchronousLogstashHandler
from logstash_async.formatter import LogstashFormatter
import logging
logstash_handler = AsynchronousLogstashHandler(
host='my_host',
port=123,
username='my_user',
password='my_password',
index_name = 'my_index')
logstash_formatter = LogstashFormatter( extra_prefix='',
extra={'customer': "name", 'ap_environment': "local"})
logstash_handler.setFormatter(logstash_formatter)
logging_handlers = []
logging_handlers.append(logstash_handler)
logging.basicConfig(
level="INFO",
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=logging_handlers)
logging.getLogger().info("Logging Message", extra = {'new_field':"value"})
Installation
pip install sag-py-logging-logstash
How to start developing
With vscode
Just install vscode with dev containers extension. All required extensions and configurations are prepared automatically.
With pycharm
- Install latest pycharm
- Configure the python interpreter/venv
- pip install requirements-dev.txt
- Restart pycharm
How to publish
- Update the version in setup.py and commit your change
- Create a tag with the same version number
- Let github do the rest
How to test
To avoid publishing to pypi unnecessarily you can do as follows
- Tag your branch however you like
- Use the chosen tag in the requirements.txt-file of the project you want to test this library in, eg.
sag_py_logging_logstash==<your tag> - Rebuild/redeploy your project
Metadata
Release files for sag-py-logging-logstash 3.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sag_py_logging_logstash-3.0.6.tar.gz | 15.6 kB | Without provenance | Details for sag_py_logging_logstash-3.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sag_py_logging_logstash-3.0.6-py3-none-any.whl | Python 3 | none | any | Details for sag_py_logging_logstash-3.0.6-py3-none-any.whl |
Total release size: 33.1 kB
Release files / sag_py_logging_logstash-3.0.6.tar.gz
| Download URL | sag_py_logging_logstash-3.0.6.tar.gz |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63624a4bd6c293d4a6c6433768b17b33a2c888b4630854b4ac974b116d054733
|
|
BLAKE2b-256 checksum How to use checksums |
1389579f355cb12373ae0f4f5617c14d8f22a1f4a1669b9fed732699557c15bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / sag_py_logging_logstash-3.0.6-py3-none-any.whl
| Download URL | sag_py_logging_logstash-3.0.6-py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
726d04da1b62d0305ccc2b2280b9cf3c6452055188c556dd1c4998093141a699
|
|
BLAKE2b-256 checksum How to use checksums |
6ecf1217cc83e5837131aca39162f117831c94b3f02626bf6c36782f378d65f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for sag-py-logging-logstash 3.0.6
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.