PHPackages                             aviationcode/laravel-ecs-logging - 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. aviationcode/laravel-ecs-logging

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

aviationcode/laravel-ecs-logging
================================

Logging Laravel log's into Elasticsearch ECS format.

v2.0.0(4y ago)2813[1 issues](https://github.com/AviationCode/laravel-ecs-logging/issues)MITPHPPHP ^8.0CI failing

Since Mar 23Pushed 4y agoCompare

[ Source](https://github.com/AviationCode/laravel-ecs-logging)[ Packagist](https://packagist.org/packages/aviationcode/laravel-ecs-logging)[ Docs](https://github.com/aviationcode/laravel-ecs-logging)[ RSS](/packages/aviationcode-laravel-ecs-logging/feed)WikiDiscussions master Synced yesterday

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

Laravel Elastic Common Scheme (ECS) Logging
===========================================

[](#laravel-elastic-common-scheme-ecs-logging)

[![Latest Version on Packagist](https://camo.githubusercontent.com/91d376a9337408d28642cea60ca0f1e7fb5131eecf54f3cc9b4f7748cd4f26af/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6176696174696f6e636f64652f6c61726176656c2d6563732d6c6f6767696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aviationcode/laravel-ecs-logging)[![Build Status](https://camo.githubusercontent.com/d615d0494ee2f7a34a0fb8d4e0fa70c7c37bb9291317d131315968625c4fa552/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6176696174696f6e636f64652f6c61726176656c2d6563732d6c6f6767696e672f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/aviationcode/laravel-ecs-logging)[![Total Downloads](https://camo.githubusercontent.com/de598fe78d885faf2b9be6f5ee88b92483a9e7e8699fc1d21871a5c72097c0ca/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6176696174696f6e636f64652f6c61726176656c2d6563732d6c6f6767696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aviationcode/laravel-ecs-logging)

This package adds ECS (Elastic Common Scheme) format to your laravel application allowing to log your standard logs to elastic.

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

[](#installation)

You can install the package via composer:

```
composer require aviationcode/laravel-ecs-logging
```

It's recommended to require `jenssegers/agent` which will add user agent logging support.

```
composer require jenssegers/agent
```

Optionally, you can publish the config file with:

```
php artisan vendor:publish --provider="AviationCode\EcsLogging\EcsLoggingServiceProvider" --tag="config"
```

Register log driver in `config/logging.php`

```
return [
    'channels' => [
        // ... Other channels

        'ecs' => [
            'driver' => 'ecs',
            'path' => storage_path('logs/ecs/laravel.json'),
            'level' => 'debug',
            'days' => 14,
        ],
    ]
];
```

If you want to use this driver as the only logging method define `LOG_CHANNEL=ecs` in your `.env` or add the `ecs` channel into your stack driver.

All `Log::xxx()` calls get logged into json file. This file can be picked up by filebeat which sends it to your logstash or elasticsearch instance.

### Configure filebeat

[](#configure-filebeat)

Add the following to your `/etc/filebeat/filebeat.yml` file

```
filebeat.inputs:
  - type: log
    enabled: true
    paths:
      - /path-to-your-laravel-app/storage/logs/ecs/*.json
    json:
      message_key: message
      keys_under_root: true
      overwrite_keys: true
```

Usage
-----

[](#usage)

### Event

[](#event)

[Event](https://www.elastic.co/guide/en/ecs/current/ecs-event.html) defines something that happened, this could be a single point in time or lasting a certain period. In order to log an event you can add this log context.

```
Log::info('Password changed for John Doe', [
    'event' => [
        'action' => 'user-password-change',
        'code' => 4648,
        'outcome' => \AviationCode\EcsLogging\Types\Event::OUTCOME_SUCCESS,
        'type' => 'user',
    ],
]);
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Ken Andries](https://github.com/DouglasDC3)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

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

Total

2

Last Release

1683d ago

Major Versions

v1.0.0 → v2.0.02021-10-01

PHP version history (2 changes)v1.0.0PHP ^7.1

v2.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/913c49cf2a71127998eb986a68d8dd81f3a9a96e5a4f9b063066a2b5c2a99a28?d=identicon)[Douglasdc3](/maintainers/Douglasdc3)

---

Top Contributors

[![Douglasdc3](https://avatars.githubusercontent.com/u/5066883?v=4)](https://github.com/Douglasdc3 "Douglasdc3 (9 commits)")

---

Tags

elasticsearcherror-monitoringhacktoberfestkibanalaravellogginglaravel-ecs-loggingaviationcode

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/aviationcode-laravel-ecs-logging/health.svg)

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

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[beyondcode/laravel-server-timing

Add Server-Timing header information from within your Laravel apps.

5712.0M1](/packages/beyondcode-laravel-server-timing)[rollbar/rollbar-laravel

Rollbar error monitoring integration for Laravel projects

14110.4M7](/packages/rollbar-rollbar-laravel)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[kitloong/laravel-app-logger

Laravel log for your application

101.2M8](/packages/kitloong-laravel-app-logger)[label84/laravel-auth-log

Log user authentication actions in Laravel.

3654.0k](/packages/label84-laravel-auth-log)

PHPackages © 2026

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