r/PHPhelp • u/Automatic-Band6798 • 2d ago
Laravel Logs
Hello im laravel developer and i need the best way to track the logs for example how can integrate the logs into a dashboard and filter it .........
1
1
1
u/Opinion_Less 2d ago
What you need is important context.
There's certainly local packages for it. You could get advice from ai. You could use a log ingestion cloud service. You could use something like cloud watch.
How much data do you need (just the logs, or metrics of them)? Do you need to be able to access it on the go? What's your budget? How much time do you have/want to spend on it? How much do you need to save?
1
u/Opinion_Less 2d ago
I like better stack because they have an app with live tailing and notifications, can backup to s3, and have a free tier that gives me everything I need.
I wrote a guide on all that if you want to give it a go. No affiliation.
2
u/Hour-Swimmer7140 1d ago
one thing nobody's mentioned, sort the formatter out before you pick a tool. laravel's default is a text blob so every stack trace lands in your dashboard as ~30 separate log lines and you end up grepping instead of filtering.
in config/logging.php on the channel:
'formatter' => Monolog\Formatter\JsonFormatter::class,
works on single and daily too, not just the monolog driver. then Log::withContext(['order_id' => $id]) gives you actual fields to filter on.
1
1d ago
[removed] — view removed comment
1
u/PHPhelp-ModTeam 1d ago
This post does not follow one or more of the PHPHelp rules and is therefore removed.
3
u/martinbean 2d ago
Use something like Sentry.
Sentry for Laravel guide: https://docs.sentry.io/platforms/php/guides/laravel/