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

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

ddtraceweb/monolog-parser
=========================

A parser for monolog log entries

1.3.1(5y ago)30333.7k—6.7%10[1 PRs](https://github.com/ddtraceweb/monolog-parser/pulls)8MITPHP

Since Mar 16Pushed 5y ago2 watchersCompare

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

READMEChangelog (5)Dependencies (2)Versions (17)Used By (8)

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

44

—

FairBetter than 92% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity71

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~179 days

Recently: every ~632 days

Total

16

Last Release

2125d ago

Major Versions

0.1.1 → 1.12013-08-19

### Community

Maintainers

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

---

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)")[![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)")[![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)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[symfony/monolog-bridge

Provides integration for Monolog with various Symfony components

2.6k189.7M258](/packages/symfony-monolog-bridge)[rollbar/rollbar

Monitors errors and exceptions and reports them to Rollbar

33723.7M82](/packages/rollbar-rollbar)[illuminate/log

The Illuminate Log package.

6224.3M518](/packages/illuminate-log)[honeybadger-io/honeybadger-php

Honeybadger PHP library

381.5M4](/packages/honeybadger-io-honeybadger-php)[graycore/magento2-stdlogging

A Magento 2 module that changes all logging handlers to stdout

2382.6k](/packages/graycore-magento2-stdlogging)

PHPackages © 2026

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