Oh Dear is the all-in-one monitoring tool for your entire website. We monitor uptime, SSL certificates, broken links, scheduled tasks and more. You'll get a notifications for us when something's wrong. All that paired with a developer friendly API and kick-ass documentation. O, and you'll also be able to create a public status page under a minute. Start monitoring using our free trial now.

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.

Comments

What are your thoughts on "Laravel Tail can now tail remote logs"?

Comments powered by Laravel Comments
Want to join the conversation? Log in or create an account to post a comment.