Sevalla is the all-in-one PaaS for your web projects. Host and deploy your applications, databases, object storage, and static sites. Enjoy advanced deployment pipelines, a complete database studio, instant preview apps, and one-click templates. The pricing is simple: no hidden fees, no seat-based pricing, and you pay only for what you use. Get real human support from developers.

Get started now with a $50 credit at Sevalla.com.

Laravel Tail can now tail remote logs

Original – by Freek Van der Herten – 2 minute read

laravel-tail is one of my favourite packages. When installed in a Laravel app it can be used to tail the log file.

To tail a log file locally, you just have to issue this command:

php artisan tail

and it'll start tailing the latest log file (so it works for both daily and single log files). Any line written to the log gets displayed immediately on your console.

Recently, we released v4 of the package. A major new addition is that the package can now also tail remote logs. To tail a remote log, you just have to add a couple of lines to your .env file.

Here's an example for freek.dev:

TAIL_HOST_PRODUCTION=freek.dev
TAIL_USER_PRODUCTION=forge
TAIL_LOG_DIRECTORY_PRODUCTION=/home/forge/freek.dev/current/storage/logs

With that in place the remote logs can be tailed with:

php artisan tail production

You can use the --lines option to also view the last X lines already present in the log.

tail

Behind the scenes this feature is powered by the SSH package we released last week.

To know more about the spatie/laravel-tail package, head over to the readme on GitHub.

Stay up to date with all things Laravel, PHP, and JavaScript.

You can follow me on these platforms:

On all these platforms, regularly share programming tips, and what I myself have learned in ongoing projects.

Every month I send out a newsletter containing lots of interesting stuff for the modern PHP developer.

Expect quick tips & tricks, interesting tutorials, opinions and packages. Because I work with Laravel every day there is an emphasis on that framework.

Rest assured that I will only use your email address to send you the newsletter and will not use it for any other purposes.