ecs-logging
Logging formatters for ECS (Elastic Common Schema) in Python
What it is and what it does
ecs-logging is a Python logging formatter that converts log records into Elastic Common Schema (ECS) JSON format. It integrates with Python's standard logging module to output structured logs that Elastic Stack tools can parse and index natively. The library implements ECS 1.6 and supports automatic correlation with Elastic APM traces when used alongside the Elastic APM Python agent, allowing logs to be linked to spans, transactions, and traces in APM dashboards.
The package has no runtime dependencies and works with Python 3.8 through 3.14. It is maintained by Elastic and marked production-stable, with active development and recent commits. Installation is straightforward via pip, and integration typically requires only adding the formatter to a logging handler.
Use it for:
- Correlate application logs with Elastic APM traces to debug performance issues across distributed systems
- Stream structured logs to Elasticsearch for centralized log aggregation and analysis
- Replace ad-hoc JSON logging with a standardized schema that Elastic tooling understands out of the box
- Standardize log format across microservices using a common schema recognized by Elastic Stack
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Formats Python logs as Elastic Common Schema (ECS) JSON, enabling structured log output compatible with Elastic Stack and APM correlation.
Yes. Low install friction, no dependencies, active maintenance, and production-stable status make it a straightforward choice if you use Elastic Stack or APM. The permissive Apache-2.0 license poses no restrictions. Install it if you need ECS-formatted logs for Elasticsearch or APM correlation; skip it if you don't use Elastic tooling.
Install
ecs-logging on PyPI
pip
pip install ecs-logginguv
uv add ecs-loggingpoetry
poetry add ecs-loggingInstalling ecs-logging
Before you install
Low install friction with no runtime dependencies. Active maintenance, last commit 2026-07-26, supporting current Python versions (3.8–3.14). Production-stable classifier.
License in practice
Apache-2.0 permissive license allows use in commercial and proprietary projects with minimal restrictions.
Quickstart
pip install ecs-logging
import logging
from ecs_logging import StdlibFormatter
logger = logging.getLogger()
handler = logging.StreamHandler()
handler.setFormatter(StdlibFormatter())
logger.addHandler(handler)
logger.info('message')
Verify before relying
- Whether ECS 1.6 implementation covers all current ECS specification features needed for your use case
- Exact APM agent version compatibility for log correlation with Elastic APM Python agent
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 207 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,912,088/month — #2,826 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ecs_logging-2.3.0-py3-none-any.whl
Tags
More Logging packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
python-json-loggerFormats Python logging output as JSON, making…
permissive · top 1,000 on PyPI
structlogstructlog is a structured logging library that…
permissive · top 1,000 on PyPI
loguruLoguru provides a pre-configured logger that…
permissive · top 1,000 on PyPI
coloredlogsAdds colored output to Python's standard…
permissive · top 1,000 on PyPI
wandbwandb is a machine learning experiment tracking…
permissive · top 1,000 on PyPI
json-loggingConfigures Python's standard logging module to…
permissive · top 5,000 on PyPI
opensearch-loggerProvides a Python logging handler that sends…
permissive · top 15,000 on PyPI
opentelemetry-instrumentation-structlogIntegrates structlog logging with OpenTelemetry…
permissive · top 15,000 on PyPI
alibabacloud-ecs20140526Provides a Python SDK for interacting with…
permissive · top 15,000 on PyPI
pylogbeatPyLogBeat sends log messages and structured…
permissive · top 5,000 on PyPI
elastic-apmElastic APM is the official Python agent for…
permissive · top 5,000 on PyPI
aliyun-python-sdk-ecsProvides Python bindings to Aliyun's Elastic…
permissive · top 15,000 on PyPI
elastic-transportProvides shared HTTP transport classes and…
permissive · top 1,000 on PyPI
python3-logstashA Python logging handler that forwards log…
permissive · top 15,000 on PyPI