opensearch-logger
OpenSearch logging handler
What it is and what it does
opensearch-logger is a Python logging handler that integrates directly with OpenSearch, bypassing the need for log aggregation middleware like Fluentd or Logstash. It formats all log records according to the Elastic Common Schema (ECS) standard, making logs searchable and aggregatable in OpenSearch. The handler buffers log records and flushes them in batches, with configurable buffer size and flush frequency to balance throughput and latency.
The library has been in production use since OpenSearch 1.0 and supports modern Python versions (3.9 through 3.13). It integrates with Python's standard logging module, allowing you to add it as a handler to any logger and configure it via logging.config or Django settings. It supports multiple authentication methods including basic auth, AWS IAM, and Kerberos, and can index into either traditional indices with date-based rotation or OpenSearch data streams.
Use it for:
- Centralize application logs from Python services directly into OpenSearch for real-time search and analysis without separate log aggregation infrastructure.
- Index structured log records with custom fields via the extra parameter to make application metrics searchable and aggregatable in OpenSearch.
- Configure logging via Django settings or logging.config to send application logs to OpenSearch alongside file or console handlers.
- Authenticate to AWS OpenSearch domains using IAM credentials or connect to Kerberos-protected OpenSearch clusters without proxy layers.
- Use data streams for log indexing to let OpenSearch manage index rollover automatically, simplifying operational overhead for high-volume logging.
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 OpenSearch, formatting them according to the Elastic Common Schema (ECS) standard without requiring middleware.
Yes. The package is production-stable (marked as such since 2021), has no known vulnerabilities, low install friction, and solves a clear problem—direct Python-to-OpenSearch logging without middleware. The aging maintenance status (366 days since release) is mitigated by a recent repository commit on 2025-08-13. Install it if you need to send Python logs to OpenSearch and want to avoid Fluentd or Logstash.
Install
opensearch-logger on PyPI
pip
pip install opensearch-loggeruv
uv add opensearch-loggerpoetry
poetry add opensearch-loggerInstalling opensearch-logger
Before you install
Low install friction; depends only on opensearch-py. Marked as aging (366 days since last release), but repository is active with a recent commit on 2025-08-13 and no known vulnerabilities.
License in practice
Apache License 2.0 (permissive). You may use, modify, and distribute this package freely in commercial and private projects, provided you include the license notice and state significant changes.
Quickstart
pip install opensearch-logger
import logging
from opensearch_logger import OpenSearchHandler
handler = OpenSearchHandler(
index_name="my-logs",
hosts=["https://localhost:9200"],
http_auth=("admin", "admin"),
use_ssl=True,
verify_certs=False
)
logger = logging.getLogger(__name__)
logger.addHandler(handler)
logger.info("Message indexed to OpenSearch")
Requires an accessible OpenSearch instance; at least one connection parameter (e.g., hosts) must be provided to the handler constructor.
Verify before relying
- Performance characteristics under high log volume or with large buffer sizes
- Compatibility with OpenSearch versions beyond 1.0 (stated as production-tested since OpenSearch 1.0 release)
Package facts
| License | Copyright 2021-2025 Vagiz Duseev Forked from https://github.com/IMInterne/python-elasticsearch-ecs-logger Copyright 2020 InnovMetric Software Forked from… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — opensearch-py |
| Maintenance | aging — 366 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 154,558/month — #10,850 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: opensearch_logger-1.3.1-py3-none-any.whl
Keywords: handler, logger, logging, opensearch
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
opensearch-pyPython client library for connecting to and…
permissive · top 1,000 on PyPI
opensearch-dslA Python client library for building and…
permissive · top 15,000 on PyPI
ecs-loggingFormats Python logs as Elastic Common Schema…
permissive · top 5,000 on PyPI
concurrent-log-handlerProvides thread-safe and process-safe logging…
permissive · top 5,000 on PyPI
django-opensearch-dslIndexes Django model instances into OpenSearch…
permissive · top 15,000 on PyPI
python3-logstashA Python logging handler that forwards log…
permissive · top 15,000 on PyPI
cloudwatchA Python logging handler that sends log events…
permissive · top 15,000 on PyPI
elasticsearch-dbapiProvides DBAPI (PEP-249) and SQLAlchemy dialect…
permissive · top 5,000 on PyPI
opensearch-mcp-server-pyProvides a Model Context Protocol (MCP) server…
permissive · top 15,000 on PyPI