PHPackages                             nzo/elk-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. nzo/elk-bundle

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

nzo/elk-bundle
==============

A Symfony bundle to manage logs on the ELK Stack

v0.1.1(5y ago)0479MITPHPPHP &gt;=7.2.5

Since Dec 22Pushed 5y ago1 watchersCompare

[ Source](https://github.com/nayzo/NzoElkBundle)[ Packagist](https://packagist.org/packages/nzo/elk-bundle)[ RSS](/packages/nzo-elk-bundle/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (2)Dependencies (7)Versions (3)Used By (0)

NzoElkBundle
============

[](#nzoelkbundle)

[![Build Status](https://camo.githubusercontent.com/111ef7709f5f94c64a81c07fc10dd37cfec38c2b7eded5882aad56c857260ca6/68747470733a2f2f7472617669732d63692e6f72672f6e61797a6f2f4e7a6f456c6b42756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/nayzo/NzoElkBundle)[![Latest Stable Version](https://camo.githubusercontent.com/b9761f998d5c78a29084a1268876094705167c9ad857cfb8ab2f3065c04921f6/68747470733a2f2f706f7365722e707567782e6f72672f6e7a6f2f656c6b2d62756e646c652f762f737461626c65)](https://packagist.org/packages/nzo/elk-bundle)

The **NzoElkBundle** is a Symfony Bundle used to manage the logs with the **ELK** stack (Elasticsearch, Logstash, Kibana).

##### Compatible with **Symfony &gt;= 4.4**

[](#compatible-with-symfony--44)

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

[](#installation)

### Through Composer:

[](#through-composer)

```
$ composer require nzo/elk-bundle

```

### Register the bundle in config/bundles.php (without Flex):

[](#register-the-bundle-in-configbundlesphp-without-flex)

```
// config/bundles.php

return [
    // ...
    Nzo\ElkBundle\NzoElkBundle::class => ['all' => true],
];
```

### Configure your application's config.yml:

[](#configure-your-applications-configyml)

```
# config/packages/nzo_elk.yaml
nzo_elk:
    app_name: '%env(ELK_APP_NAME)%'
    app_environment: '%env(ELK_APP_ENVIRONMENT)%'

    log_encryptor:                               # Optional
        secret_key: '%env(ELK_LOG_SECRET)%'      # Required
        fields:                                  # Required
            - email
            - username
            - ...

# .env
ELK_APP_NAME=app
ELK_APP_ENVIRONMENT=local
```

Usage
-----

[](#usage)

##### Using the JSON formatter

[](#using-the-json-formatter)

In the definition of the handlers, simply add the `nzo.elk.monolog.formatter` formatter.

Example :

```
api_errors:
    type: stream
    path: '%kernel.logs_dir%/%kernel.environment%.elk_api_errors.log'
    level: errors
    channels: ['api']
    formatter: nzo.elk.monolog.formatter
```

Encrypt Logs
------------

[](#encrypt-logs)

This bundle offer a secure way to encrypt sensitive data sent in the logs.

To do so, You must enable and set the **log\_encryptor** configuration and the **secret\_key**.

In the **fields** configuration you must add the logs context fields that you want to be encrypted. These fields must be shared in the ELK stack in order to enable the decryption for them.

##### Setup:

[](#setup)

```
// config/bundles.php

return [
    // ...
    Nzo\UrlEncryptorBundle\NzoUrlEncryptorBundle::class => ['all' => true],
];
```

##### Configuration:

[](#configuration)

```
# config/packages/nzo_elk.yaml
nzo_elk:
    # ...
    log_encryptor:
        secret_key: '%env(ELK_LOG_SECRET)%'
        fields:
            - email
            - username
            - location.address.code

# .env
ELK_LOG_SECRET=SOME_SECRET
```

##### Usage:

[](#usage-1)

```
public function log()
{
    $context = [
        'name' => 'Wolverine',
        'username' => 'test',
        'email' => 'test@example.fr',
        'location' => [
            'address' => [
                'code' => '75000',
                'city' => 'Paris',
                'country' => 'France'
            ]
        ]
    ];

    $this->logger->error('Error', $context);
}

// The log output will be like:
[
    'name' => 'Wolverine',
    'username' => 'FbEtXzIRop0FFK31MdC+McgbWybD...',
    'email' => 'DNXDcuQDn7LbwlgLKnAgPsn...',
    'location' => [
        'address' => [
            'code' => 'FnzOIHjMZDzDmSSC...',
            'city' => 'pdjKJBDfd2Khdfkhbfk....',
            'country' => 'France'
        ]
    ]
]
```

License
-------

[](#license)

This bundle is under the MIT license. See the complete license in the bundle:

See [LICENSE](https://github.com/nayzo/NzoElkBundle/tree/master/LICENSE)

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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 ~0 days

Total

2

Last Release

1970d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/43973d4c7b23026540ed9f2670200cbd664d7ae7c55126feb465e62ba7a2a86f?d=identicon)[nayzo](/maintainers/nayzo)

---

Top Contributors

[![nayzo](https://avatars.githubusercontent.com/u/1272883?v=4)](https://github.com/nayzo "nayzo (2 commits)")

---

Tags

logelasticsearchELKlogstashkibana

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nzo-elk-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/nzo-elk-bundle/health.svg)](https://phpackages.com/packages/nzo-elk-bundle)
```

###  Alternatives

[index0h/yii2-log

Many Yii2 log targets

49204.5k](/packages/index0h-yii2-log)[nulpunkt/monolog-elasticsearch-logstashformat

Use the logstash formatter with elasticsearch

3570.1k](/packages/nulpunkt-monolog-elasticsearch-logstashformat)

PHPackages © 2026

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