PHPackages                             syonix/monolog-parser - 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. syonix/monolog-parser

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

syonix/monolog-parser
=====================

A parser for monolog log entries

0370PHP

Since Aug 27Pushed 1y agoCompare

[ Source](https://github.com/Syonix/monolog-parser)[ Packagist](https://packagist.org/packages/syonix/monolog-parser)[ RSS](/packages/syonix-monolog-parser/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Monolog Parser [![Build Status](https://camo.githubusercontent.com/4a7e97bcb1b4eff90fab5a0b3647a55742b2c374845ab99fae5fb02ceab85d3a/68747470733a2f2f7472617669732d63692e6f72672f646474726163657765622f6d6f6e6f6c6f672d7061727365722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/ddtraceweb/monolog-parser)
=========================================================================================================================================================================================================================================================================================================================

[](#monolog-parser-)

A simple library for parsing [monolog](https://github.com/Seldaek/monolog) logfiles.

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

[](#installation)

You can install the library using composer by adding `ddtraceweb/monolog-parser` to your `composer.json`.

Usage
-----

[](#usage)

- 1 days of logs

```
    require_once 'path/to/vendor/autoload.php';

    use Dubture\Monolog\Reader\LogReader;

    $logFile = '/path/to/some/monolog.log';
    $reader = new LogReader($logFile);

    foreach ($reader as $log) {
        echo sprintf("The log entry was written at %s. \n", $log['date']->format('Y-m-d h:i:s'));
    }

    $lastLine = $reader[count($reader)-1];
    echo sprintf("The last log entry was written at %s. \n", $lastLine['date']->format('Y-m-d h:i:s'));
```

- options unlimited days logs

```
    require_once 'path/to/vendor/autoload.php';

    use Dubture\Monolog\Reader\LogReader;

    $logFile = '/path/to/some/monolog.log';
    $reader = new LogReader($logFile, 0);

    foreach ($reader as $log) {
        echo sprintf("The log entry was written at %s. \n", $log['date']->format('Y-m-d h:i:s'));
    }

    $lastLine = $reader[count($reader)-1];
    echo sprintf("The last log entry was written at %s. \n", $lastLine['date']->format('Y-m-d h:i:s'));
```

- options 2 days logs

```
    require_once 'path/to/vendor/autoload.php';

    use Dubture\Monolog\Reader\LogReader;

    $logFile = '/path/to/some/monolog.log';
    $reader = new LogReader($logFile, 2);

    foreach ($reader as $log) {
        echo sprintf("The log entry was written at %s. \n", $log['date']->format('Y-m-d h:i:s'));
    }

    $lastLine = $reader[count($reader)-1];
    echo sprintf("The last log entry was written at %s. \n", $lastLine['date']->format('Y-m-d h:i:s'));
```

- Add custom pattern

```
    require_once 'path/to/vendor/autoload.php';

    use Dubture\Monolog\Reader\LogReader;

    $logFile = '/path/to/some/monolog.log';
    $reader = new LogReader($logFile);

    $pattern = '/\[(?P.*)\] (?P[\w-\s]+).(?P\w+): (?P[^\[\{]+) (?P[\[\{].*[\]\}]) (?P[\[\{].*[\]\}])/';
    $reader->getParser()->registerPattern('newPatternName', $pattern);
    $reader->setPattern('newPatternName');

    foreach ($reader as $log) {
        echo sprintf("The log entry was written at %s. \n", $log['date']->format('Y-m-d h:i:s'));
    }

    $lastLine = $reader[count($reader)-1];
    echo sprintf("The last log entry was written at %s. \n", $lastLine['date']->format('Y-m-d h:i:s'));
```

[![Bitdeli Badge](https://camo.githubusercontent.com/57716727935d64e1b9872f5c4199b412e606d68892c319c234d647f851480579/68747470733a2f2f64327765637a68766c38323376302e636c6f756466726f6e742e6e65742f646474726163657765622f6d6f6e6f6c6f672d7061727365722f7472656e642e706e67)](https://bitdeli.com/free "Bitdeli Badge")

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ab4040af9ad9c50643c83be0be008a751c14be693e6c4e1376b8de692e1f81ce?d=identicon)[syonix](/maintainers/syonix)

---

Top Contributors

[![ddtraceweb](https://avatars.githubusercontent.com/u/2129919?v=4)](https://github.com/ddtraceweb "ddtraceweb (11 commits)")[![pulse00](https://avatars.githubusercontent.com/u/185278?v=4)](https://github.com/pulse00 "pulse00 (6 commits)")[![daviddjian](https://avatars.githubusercontent.com/u/754950?v=4)](https://github.com/daviddjian "daviddjian (5 commits)")[![Patrick-Legrand](https://avatars.githubusercontent.com/u/37579189?v=4)](https://github.com/Patrick-Legrand "Patrick-Legrand (1 commits)")[![philwc](https://avatars.githubusercontent.com/u/617110?v=4)](https://github.com/philwc "philwc (1 commits)")[![mpbzh](https://avatars.githubusercontent.com/u/6039062?v=4)](https://github.com/mpbzh "mpbzh (1 commits)")[![Cangit](https://avatars.githubusercontent.com/u/1426157?v=4)](https://github.com/Cangit "Cangit (1 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")

### Embed Badge

![Health badge](/badges/syonix-monolog-parser/health.svg)

```
[![Health](https://phpackages.com/badges/syonix-monolog-parser/health.svg)](https://phpackages.com/packages/syonix-monolog-parser)
```

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M138](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[ekino/newrelic-bundle

Integrate New Relic into Symfony2

28111.2M8](/packages/ekino-newrelic-bundle)

PHPackages © 2026

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