Extension / Wrapper for structlog library.
Project description
Elastic Structlog Extension - 'elastic_structlog'
elastic_structlog is python package that provides functionality in order to send logs to elastic directly. This package is an extension for the package 'structlog'. In order to use the library suggesting to read the official documentation of structlog
Installation
Use the package manager pip to install elastic_structlog.
pip install elastic_structlog
Usage
Configuration:
In order to configure the logger, the package provide two options:
Manual Confuguration:
from elastic_structlog import ESStructLogExtension
# First create ESStructLogExtension instance.
es_extension = ESStructLogExtension(
host="http://HOST:PORT",
basic_auth=("USER_NAME", "PASSWORD"),
index="INDEX_EXAMPLE",
flush_frequency=5,
raise_on_indexing_error=False,
verify_certs=True
)
# Second, configure the structlog - use directly the original module of structlog.
# Notice how you should use the processor that the package offers:
structlog.configure(
processors=[
structlog.contextvars.merge_contextvars,
structlog.processors.format_exc_info,
structlog.processors.TimeStamper(fmt="iso"),
elastic_structlog.elastic_processor.ESStructLogProcessor(es_extension=es_extension),
structlog.processors.KeyValueRenderer()
]
)
Built-in 'configure_es_structlog_logger' function:
from elastic_structlog.elastic_processor import configure_es_structlog_logger
configure_es_structlog_logger(
host="http://HOST:PORT",
basic_auth=("USER_NAME", "PASSWORD"),
index="INDEX_EXAMPLE",
flush_frequency=5,
verify_certs=False,
)
SDI Team - Nuriel Gadilov - 1.19.2025
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file elastic_structlog-0.0.4.tar.gz.
File metadata
- Download URL: elastic_structlog-0.0.4.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6adfb94a29ebdaf191a869c5115f03ad4900258d70a9bc1a6dbf5a74010dfe05
|
|
| MD5 |
1effcf871e467c6fd29091acee0b6afa
|
|
| BLAKE2b-256 |
de658fe60b8e82014adfc30c7ec294133238f263dd4ff8784a2b97253c9c9435
|
File details
Details for the file elastic_structlog-0.0.4-py3-none-any.whl.
File metadata
- Download URL: elastic_structlog-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ddb1802f47791c62aecbff44bacad84968b194dac7082c534fb0d79678ed6d7
|
|
| MD5 |
8ae490420fc56830fff2180e61e9b10a
|
|
| BLAKE2b-256 |
8b50d52fc3974c4258b03d9f9d66382916dbb71b2ffc44d779d1d74a653ac97a
|