--- id: cmreshandler version: "1.0.0" license: Apache2 license_treatment: permissive maintenance: dormant --- # CMRESHandler — Elasticsearch Log handler for the logging library License: permissive · Maintenance: dormant · Downloads: 313.4K/mo ## What it is and what it does CMRESHandler is a logging handler that bridges Python's standard logging library and Elasticsearch, allowing you to send log records directly to Elasticsearch indices instead of (or in addition to) files or stdout. It wraps log entries as JSON documents and buffers them before flushing to Elasticsearch, supporting optional authentication (basic, Kerberos, AWS IAM) and SSL encryption. The handler integrates with Django logging configuration and lets you attach custom fields to individual log records for instrumentation—for example, timing metrics or request IDs—which then become queryable fields in Elasticsearch. It preserves standard logging metadata like exception tracebacks, method names, and line numbers, making it useful for centralized log aggregation and analysis. Use it for: - Centralize application logs from multiple Python services into a single Elasticsearch cluster for unified search and analysis. - Instrument Django applications to log database query times and SQL statements alongside application events for performance monitoring. - Add custom fields to logs on a per-message basis to enable rich filtering and aggregation in Elasticsearch. - Replace file-based logging with Elasticsearch to avoid log rotation and disk management overhead in containerized environments. - Combine Elasticsearch logging with other handlers to send critical errors to files while routing all logs to Elasticsearch for analysis. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a Python logging handler that sends log records directly to Elasticsearch, integrating with the standard logging library to store structured logs in Elasticsearch indices. Yes, if you are already running Elasticsearch and need a lightweight Python logging handler to send logs directly to it. No, if you require active maintenance or support for modern Elasticsearch versions—the package is dormant since 2017-10-08 and has not been updated to verify compatibility with current Elasticsearch releases. Consider it a stable but unsupported tool; test thoroughly with your Elasticsearch version before production use. ## Install pip install cmreshandler uv add cmreshandler poetry add cmreshandler ## Installing CMRESHandler Before you install: Low install friction with pure-Python wheels available for both Python 2 and 3. However, the package is dormant—last release was 2017-10-08 and no commits since 2024-06-06. Elasticsearch client compatibility with modern versions is unverified. License in practice: Licensed under Apache2 (permissive), so you can use, modify, and distribute the package freely in commercial and open-source projects without restrictive obligations. Quickstart: pip install CMRESHandler from cmreslogging.handlers import CMRESHandler import logging handler = CMRESHandler(hosts=[{'host': 'localhost', 'port': 9200}], auth_type=CMRESHandler.AuthType.NO_AUTH, es_index_name="my_python_index") log = logging.getLogger("PythonTest") log.addHandler(handler) log.info("This is logged to Elasticsearch") Requires a running Elasticsearch server accessible at the configured host and port; optional dependencies (requests-kerberos, requests-aws4auth) needed only for Kerberos or AWS IAM authentication. Verify before relying: - Compatibility with modern Elasticsearch versions given the last release was 2017-10-08. - Whether the elasticsearch dependency pins to a specific major version or accepts current releases. - Support status for Python versions beyond 2.7 and 3.6 as stated in classifiers. ## Package facts - License: Apache2 (permissive) - Python support: unspecified - Install friction: low - Maintenance: dormant - Downloads: 313.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags elasticsearch logging handler, python logs to elasticsearch, elasticsearch appender, structured logging elasticsearch, elasticsearch log integration, python logging elasticsearch, log handler elasticsearch, elasticsearch, logging, django-integration [View on SkillFed](https://skillfed.io/packages/cmreshandler) · [View on PyPI](https://pypi.org/project/cmreshandler/)