PHPackages                             aubes/ecs-logging-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. aubes/ecs-logging-bundle

ActiveSymfony-bundle[Logging &amp; Monitoring](/categories/logging)

aubes/ecs-logging-bundle
========================

Symfony bundle providing the Ecs log format

v3.1.1(2mo ago)1496↓87.5%MITPHPPHP &gt;=8.2CI passing

Since May 2Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/aubes/ecs-logging-bundle)[ Packagist](https://packagist.org/packages/aubes/ecs-logging-bundle)[ RSS](/packages/aubes-ecs-logging-bundle/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (7)Dependencies (24)Versions (15)Used By (0)

ECS Logging Bundle
==================

[](#ecs-logging-bundle)

[![CI](https://github.com/aubes/ecs-logging-bundle/actions/workflows/php.yml/badge.svg)](https://github.com/aubes/ecs-logging-bundle/actions/workflows/php.yml/badge.svg)[![Latest Stable Version](https://camo.githubusercontent.com/01ee4f862dc01084b8a52e2d9d0afae8065a9da53e49061c7e7c45b90f1a10e3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61756265732f6563732d6c6f6767696e672d62756e646c65)](https://packagist.org/packages/aubes/ecs-logging-bundle)[![License](https://camo.githubusercontent.com/05f64177719a9239d7a4106beaf9fae1881f05e1ba69694cdf3100e61cc002bf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f61756265732f6563732d6c6f6767696e672d62756e646c65)](https://packagist.org/packages/aubes/ecs-logging-bundle)[![PHP Version](https://camo.githubusercontent.com/1ad0b002805c3c4a6a8ba6888e921e4d9c2ac2b163258d68fd8debba613784b2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f61756265732f6563732d6c6f6767696e672d62756e646c652f706870)](https://packagist.org/packages/aubes/ecs-logging-bundle)

A Symfony bundle that formats Monolog logs as [Elastic Common Schema (ECS)](https://www.elastic.co/guide/en/ecs/current/ecs-reference.html) NDJSON, ready to be ingested by Elasticsearch and visualised in Kibana without any index mapping configuration.

Built on top of [elastic/ecs-logging](https://github.com/elastic/ecs-logging-php).

### What's included

[](#whats-included)

ComponentDescription**`EcsFormatter`**Produces ECS-compliant NDJSON (`log.level` lowercase, `ecs.version` and `tags` configurable)**`ServiceProcessor`**Injects static `service.*` metadata (name, version, id…) into every record**`ErrorProcessor`**Converts a `\Throwable` in context to ECS `error.*` fields. `map_exception_key` also catches Symfony's native exceptions**`TracingProcessor`**Maps tracing data to ECS `trace.id`, `transaction.id`, `span.id` (supports manual arrays and OpenTelemetry flat keys)**`CorrelationIdProcessor`**Maps a correlation ID from Monolog `extra` to ECS `labels.correlation_id` or `trace.id`**`UserProcessor`**Injects the authenticated user as ECS `user.*` via a customisable provider**`HttpRequestProcessor`**Injects ECS `http.*`, `url.*`, and optionally `client.ip` from the current request**`HostProcessor`**Injects static ECS `host.*` fields resolved once at boot time**`AutoLabelProcessor`**Removes non-ECS context keys to protect the ECS namespace, optionally moving them into `labels`### Notable defaults

[](#notable-defaults)

- **Sensitive fields opt-in** — `client.ip`, `url.query`, `http.request.referrer`, and `user.*` (PII — see [UserProcessor](docs/processors/user.md)) are disabled by default
- **FrankenPHP worker mode** — stateful processors implement `ResetInterface`
- **ECS namespace protection** — `AutoLabelProcessor` prevents non-ECS fields from polluting root-level keys
- **ECS 8.x and 9.x** — `ecs.version` defaults to `9.3.0`, configurable per deployment

### Output example

[](#output-example)

```
{
    "@timestamp": "2025-03-21T10:00:00.000000+00:00",
    "message": "Payment failed",
    "ecs.version": "9.3.0",
    "log": {
        "level": "error",
        "logger": "app"
    },
    "service": {
        "name": "checkout",
        "version": "1.4.2"
    },
    "error": {
        "type": "RuntimeException",
        "message": "Gateway timeout",
        "code": "504"
    },
    "trace": {
      "id": "123abc123abc123abc123abc123abc12"
    },
    "user": {
      "name": "alice"
    },
    "http": {
        "request": {
            "method": "POST",
            "mime_type": "application/json"
        },
        "version": "1.1"
    },
    "url": {
        "path": "/checkout/pay",
        "scheme": "https",
        "domain": "shop.example.com"
    }
}
```

### Compatibility

[](#compatibility)

- PHP &gt;= 8.2
- Symfony 6.4 | 7.4 | 8.0 — LTS versions only
- Monolog 3.x
- FrankenPHP (worker mode)
- ECS 8.x and 9.x

Installation
------------

[](#installation)

```
composer require aubes/ecs-logging-bundle
```

Quick start
-----------

[](#quick-start)

**1. Configure the formatter in Monolog:**

```
# config/packages/monolog.yaml
monolog:
    handlers:
        main:
            type: stream
            path: "%kernel.logs_dir%/%kernel.environment%.log"
            level: info
            formatter: 'monolog.formatter.ecs'
```

**2. Enable the bundle and configure at least one processor:**

```
# config/packages/ecs_logging.yaml
ecs_logging:
    monolog:
        handlers: ['main']

    processor:
        service:
            enabled: true
            name: 'my-app'
            version: '%env(string:APP_VERSION)%'
```

Documentation
-------------

[](#documentation)

- [Configuration reference](docs/configuration-reference.md)
- [Logging a Symfony app in ECS format](docs/symfony-logs.md)
- [Advanced example](docs/advanced-example.md)
- Processors
    - [ServiceProcessor](docs/processors/service.md)
    - [ErrorProcessor](docs/processors/error.md)
    - [TracingProcessor](docs/processors/tracing.md)
    - [CorrelationIdProcessor](docs/processors/correlation-id.md)
    - [UserProcessor](docs/processors/user.md)
    - [AutoLabelProcessor](docs/processors/auto-label.md)
    - [HttpRequestProcessor](docs/processors/http-request.md)
    - [HostProcessor](docs/processors/host.md)

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance88

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~155 days

Recently: every ~9 days

Total

8

Last Release

61d ago

Major Versions

v1.0.0 → v2.0.02026-03-04

v2.0.2 → v3.0.02026-03-25

PHP version history (3 changes)v1.0.0PHP &gt;=7.4

v2.0.0PHP &gt;=8.1

v3.0.0PHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3941035?v=4)[A. Bes](/maintainers/aubes)[@aubes](https://github.com/aubes)

---

Top Contributors

[![aubes](https://avatars.githubusercontent.com/u/3941035?v=4)](https://github.com/aubes "aubes (17 commits)")

---

Tags

ecsmonologmonolog-formattermonolog-processorphpsymfonysymfony-bundlesymfonyloggingelasticmonologSymfony BundleECSElastic Common Schema

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/aubes-ecs-logging-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/aubes-ecs-logging-bundle/health.svg)](https://phpackages.com/packages/aubes-ecs-logging-bundle)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
