spatie/laravel-tail
Tail your Laravel application logs from the command line. Run php artisan tail to follow local single or daily logs, or tail remote environment logs over SSH (e.g., production) with configurable host, user, log directory, and optional file selection.
Install the package via Composer: composer require spatie/laravel-tail. No additional service provider registration needed — it’s auto-discovered. Run php artisan tail to stream the current storage/logs/laravel.log. For a snapshot of recent entries, add --lines=10 (or any number). To filter output in real time, use --grep="ERROR" — perfect for spotlighting failures during debugging.
php artisan tail --clear in a split terminal to keep only the latest log line visible — ideal for hot-reloading apps. Combine with --grep and --lines to create custom logging dashboards (e.g., php artisan tail --grep="^WARN" --lines=30 --clear).config/tail.php (via env vars: TAIL_HOST_PRODUCTION, TAIL_USER_PRODUCTION, etc.). Run php artisan tail staging to tail logs from a remote server over SSH — no manual tail -f commands needed.php artisan debug:tail-error) that internally invoke Artisan::call('tail', ['--grep' => 'ERROR']) for reusable diagnostics.--file="custom.log" to target specific logs (e.g., during feature testing where logs are rotated or redirected), avoiding interference with app logs.ssh access works before using php artisan tail production. Private keys must be in ~/.ssh/id_rsa or configured via SSH config.\ to bypass aliases — but be cautious if your shell has custom tail/ssh functions. Check .env env vars match config keys exactly (case-sensitive).--file is specified, the command uses the most recently modified .log file in the log directory — ensure production logs aren’t rotated mid-stream (use --file="laravel.log" for stability).--grep uses grep -E (extended regex) — use --grep="ERROR|WARN" safely, but avoid complex patterns needing backslashes. On Windows, grep might be missing — install GNU grep or fallback to --file="laravel.log" | tail -f manually.tail command was removed; this package restores core functionality — ideal for upgrades where legacy workflows relied on it.How can I help you explore Laravel packages today?