skillfed

CMRESHandler

Elasticsearch Log handler for the logging library

cmreshandler v1.0.0 313.4K downloads/30d#7,715 on PyPI235
Permissive license Apache2 DORMANT released

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 on this page — 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

cmreshandler on PyPI

pip

pip install cmreshandler

uv

uv add cmreshandler

poetry

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 not specified
Install friction low — pure-Python wheel
Runtime dependencies 3 — elasticsearch, enum, requests
Maintenance dormant — 3,232 days since the last release
Last repo commit
First released
Downloads 313,416/month — #7,715 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: CMRESHandler-1.0.0-py2-none-any.whl; CMRESHandler-1.0.0-py3-none-any.whl

Keywords: logging, elasticsearch, handler, log, django, instrumentation

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 2.7Programming Language :: Python :: 3.6Topic :: Internet :: Log AnalysisTopic :: Software Development :: LibrariesTopic :: System :: Logging

Tags

elasticsearch logging handlerpython logs to elasticsearchelasticsearch appenderstructured logging elasticsearchelasticsearch log integrationpython logging elasticsearchlog handler elasticsearch
elasticsearchloggingdjango-integration

More Libraries packages

urllib3

urllib3 is an HTTP client library that provides…

permissive · top 100 on PyPI

requests

Requests is a Python HTTP library that…

permissive · top 100 on PyPI

pluggy

Pluggy provides a plugin system that lets you…

permissive · top 100 on PyPI

python-dateutil

Provides parsing, arithmetic, and recurrence…

permissive · top 100 on PyPI

six

Six provides utility functions to write Python…

permissive · top 100 on PyPI

pytest

pytest is a testing framework that lets you…

permissive · top 100 on PyPI

opensearch-logger

Provides a Python logging handler that sends…

permissive · top 15,000 on PyPI

python3-logstash

A Python logging handler that forwards log…

permissive · top 15,000 on PyPI

opentelemetry-instrumentation-elasticsearch

Adds distributed tracing to Elasticsearch…

permissive · top 5,000 on PyPI

google-cloud-appengine-logging

Client library for Google Cloud AppEngine…

permissive · top 1,000 on PyPI

django-opensearch-dsl

Indexes Django model instances into OpenSearch…

permissive · top 15,000 on PyPI

elasticsearch

Official Python client library for connecting…

permissive · top 1,000 on PyPI

elasticsearch8-dsl

A high-level Python query builder for…

permissive · top 15,000 on PyPI

elasticsearch7

Official Python client for Elasticsearch that…

permissive · top 15,000 on PyPI

django-elasticsearch-dsl-drf

Provides Django REST framework views,…

copyleft · top 15,000 on PyPI

opentelemetry-instrumentation-logging

Integrates Python's standard logging module…

permissive · top 1,000 on PyPI