elastic-structlog


Nameelastic-structlog JSON
Version 0.2.4 PyPI version JSON
download
home_pageNone
SummaryExtension / Wrapper for structlog library.
upload_time2025-01-20 15:09:16
maintainerNone
docs_urlNone
authorNuriel Gadilov
requires_pythonNone
licenseNone
keywords python structlog es elastic
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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](https://www.structlog.org/en/stable/getting-started.html#installation)

## Installation

Use the package manager [pip](https://pip.pypa.io/en/stable/) to install elastic_structlog.

```bash
pip install elastic_structlog
```

## Usage
### Configuration:
In order to configure the logger, the package provide two options:

#### Manual Confuguration:

```python
from elastic_structlog import ESStructLogExtension, ESStructLogProcessor
import structlog
# First create ESStructLogExtension instance.
es_extension = ESStructLogExtension(
    host="https://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"),
        ESStructLogProcessor(es_extension=es_extension),
        structlog.processors.KeyValueRenderer()
    ]
)
```

#### Built-in 'configure_es_structlog_logger' function:
```python
from elastic_structlog.elastic_processor import configure_es_structlog_logger

configure_es_structlog_logger(
    host="https://HOST:PORT",
    basic_auth=("USER_NAME", "PASSWORD"),
    index="INDEX_EXAMPLE",
    flush_frequency=5,
    verify_certs=False, #Default - True
    raise_on_indexing_error=True #Default - False
)
```

## SDI Team - Nuriel Gadilov - 1.20.2025

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "elastic-structlog",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "python, structlog, es, elastic",
    "author": "Nuriel Gadilov",
    "author_email": "nurielprivet@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/95/14/8049c3f86d59fca3060d3449c747af04c6c35563a7aab00803c8880afb83/elastic_structlog-0.2.4.tar.gz",
    "platform": null,
    "description": "# Elastic Structlog Extension - 'elastic_structlog'\n\nelastic_structlog is python package that provides functionality in order to send logs to elastic directly.\nThis package is an extension for the package 'structlog'. In order to use the library suggesting to read the [official documentation of structlog](https://www.structlog.org/en/stable/getting-started.html#installation)\n\n## Installation\n\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install elastic_structlog.\n\n```bash\npip install elastic_structlog\n```\n\n## Usage\n### Configuration:\nIn order to configure the logger, the package provide two options:\n\n#### Manual Confuguration:\n\n```python\nfrom elastic_structlog import ESStructLogExtension, ESStructLogProcessor\nimport structlog\n# First create ESStructLogExtension instance.\nes_extension = ESStructLogExtension(\n    host=\"https://HOST:PORT\",\n    basic_auth=(\"USER_NAME\", \"PASSWORD\"),\n    index=\"INDEX_EXAMPLE\",\n    flush_frequency=5,\n    raise_on_indexing_error=False,\n    verify_certs=True\n)\n\n# Second, configure the structlog - use directly the original module of structlog.\n# Notice how you should use the processor that the package offers:\nstructlog.configure(\n    processors=[\n        structlog.contextvars.merge_contextvars,\n        structlog.processors.format_exc_info,\n        structlog.processors.TimeStamper(fmt=\"iso\"),\n        ESStructLogProcessor(es_extension=es_extension),\n        structlog.processors.KeyValueRenderer()\n    ]\n)\n```\n\n#### Built-in 'configure_es_structlog_logger' function:\n```python\nfrom elastic_structlog.elastic_processor import configure_es_structlog_logger\n\nconfigure_es_structlog_logger(\n    host=\"https://HOST:PORT\",\n    basic_auth=(\"USER_NAME\", \"PASSWORD\"),\n    index=\"INDEX_EXAMPLE\",\n    flush_frequency=5,\n    verify_certs=False, #Default - True\n    raise_on_indexing_error=True #Default - False\n)\n```\n\n## SDI Team - Nuriel Gadilov - 1.20.2025\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Extension / Wrapper for structlog library.",
    "version": "0.2.4",
    "project_urls": null,
    "split_keywords": [
        "python",
        " structlog",
        " es",
        " elastic"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4ec9bf69948344b466618709f089e6d67aed044df01d3aba969eb63c6079d107",
                "md5": "767f943021faf0adc24b648174e3a384",
                "sha256": "ac912d622f0c2fa1249df2b679c7d9fd234c9fc4464c53326531fbcab2f3dae5"
            },
            "downloads": -1,
            "filename": "elastic_structlog-0.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "767f943021faf0adc24b648174e3a384",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7884,
            "upload_time": "2025-01-20T15:09:14",
            "upload_time_iso_8601": "2025-01-20T15:09:14.812882Z",
            "url": "https://files.pythonhosted.org/packages/4e/c9/bf69948344b466618709f089e6d67aed044df01d3aba969eb63c6079d107/elastic_structlog-0.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "95148049c3f86d59fca3060d3449c747af04c6c35563a7aab00803c8880afb83",
                "md5": "8bbf6d99eef47d7fcfd05946997386a8",
                "sha256": "75947a38d8d21e8ce618f393da25b8cf604a1976b5b1acc4c89b4a021a581b71"
            },
            "downloads": -1,
            "filename": "elastic_structlog-0.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "8bbf6d99eef47d7fcfd05946997386a8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5625,
            "upload_time": "2025-01-20T15:09:16",
            "upload_time_iso_8601": "2025-01-20T15:09:16.268745Z",
            "url": "https://files.pythonhosted.org/packages/95/14/8049c3f86d59fca3060d3449c747af04c6c35563a7aab00803c8880afb83/elastic_structlog-0.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-20 15:09:16",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "elastic-structlog"
}
        
Elapsed time: 0.43522s