Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Monolog Parser

Monolog Parser Laravel Package

ddtraceweb/monolog-parser

Laravel-friendly Monolog parser that reads and normalizes Monolog log records/lines for easier searching, filtering, and display. Useful for building log viewers, dashboards, or importing Monolog output into your own storage or analysis pipeline.

View on GitHub
Deep Wiki
Context7

A simple library for parsing monolog logfiles.

Frequently asked questions about Monolog Parser
How do I install ddtraceweb/monolog-parser in a Laravel project?
Run `composer require ddtraceweb/monolog-parser` in your project directory. The package requires PHP 7.2+ and Monolog 2.0+ (default in Laravel 8+), so no additional setup is needed beyond Composer autoloading.
Can this package parse Laravel’s default log files (e.g., storage/logs/laravel.log)?
Yes, it’s designed for Laravel’s Monolog logs. Use the `Parser` class to read and parse raw log files: `$parser = new Parser(); $logs = $parser->parse(file_get_contents(storage_path('logs/laravel.log')));`
Will this work with custom Monolog handlers or log channels?
The parser supports standard Monolog formats, including custom handlers, as long as the logs follow Monolog’s default structure. For non-standard formats, you may need to register a custom pattern via `$reader->getParser()->registerPattern()`.
Is this package compatible with Laravel 9/10 and PHP 8.x?
While the package was last updated in 2020, it should work with Laravel 9/10 and PHP 8.x since it only depends on PHP 7.2+ and Monolog 2.0+. Test thoroughly, especially with PHP 8’s type system changes.
How do I parse logs programmatically vs. via CLI?
For programmatic use, instantiate the `Parser` class in PHP. For CLI, create an Artisan command (e.g., `php artisan logs:parse`) that reads and parses logs, then outputs structured JSON or processes them further.
Does this package support real-time log parsing (e.g., streaming logs as they’re written)?
No, this package reads existing log files. For real-time parsing, consider integrating with Monolog’s handlers directly or using a dedicated log shipper like Filebeat to stream logs to an analysis pipeline.
How can I validate or test the parsed log output?
Unit test the parser by feeding it known log formats (e.g., malformed logs, custom contexts) and asserting the output structure. Use `assertEquals()` to compare parsed logs against expected JSON/arrays.
Is this package suitable for production log analysis at scale?
For large log volumes, parsing in-memory may be slow. Optimize by reading logs line-by-line or offloading parsing to a queue worker (e.g., Laravel Queues). Avoid parsing during peak traffic.
What alternatives exist for parsing Laravel Monolog logs?
Alternatives include custom regex parsing, `spatie/laravel-log-viewer` (for UI-based log inspection), or dedicated log shippers like Fluentd/Filebeat. If you need APM integration, consider tools like Datadog’s log ingestion.
How do I handle logs with missing or malformed data (e.g., no timestamp or context)?
The parser may throw errors on malformed logs. Handle exceptions with `try-catch` and log warnings. For robustness, enforce structured logging in Laravel (e.g., `Log::info('Event', ['key' => 'value'])`) to ensure consistent formats.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky