skillfed

ecs-logging

Logging formatters for ECS (Elastic Common Schema) in Python

ecs-logging v2.3.0 2.9M downloads/30d#2,826 on PyPI73
Permissive license Active released

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-logging

uv

uv add ecs-logging

poetry

poetry add ecs-logging

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: System :: Logging

Tags

ECS logging formatterelastic common schema pythonstructured JSON loggingelastic stack log integrationAPM log correlationelasticsearch logging formatstructured logging python
structured-loggingelastic-stackapm-integration

More Logging packages