Datadog collects and monitors your PHP app metrics and distributed traces in real-time with application performance monitoring. Decrease downtime and performance issues with Datadog APM by tracing requests across service boundaries and drilling into individual traces end-to-end with flame graphs. Start your 14-day trial for free today.

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.

Follow me on Twitter. I regularly tweet out programming tips, and what I myself have learned in ongoing projects.

Every two weeks 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

Webmentions

mjczz retweeted on 19th February 2020
Roberto De la Fuente liked on 19th February 2020
Nino Paolo liked on 19th February 2020
Terry Rowland retweeted on 19th February 2020
Terry Rowland liked on 19th February 2020
Roberto Aguilar liked on 19th February 2020
Leonardo Garcia liked on 18th February 2020
Thomas Banks liked on 18th February 2020
Heru Hang Tryputra liked on 18th February 2020
Alexandre liked on 18th February 2020
Lee Overy liked on 18th February 2020
Lawrence Enehizena retweeted on 18th February 2020
Mohammed Mouheb liked on 18th February 2020
Sunit Panwar liked on 18th February 2020
Lawrence Enehizena liked on 18th February 2020
Siarhei Pashkevich liked on 18th February 2020
Tom Harper liked on 18th February 2020
Dionysios Arvanitis liked on 18th February 2020
Abbah Anoh liked on 18th February 2020
abdujuk liked on 18th February 2020
Antonis Sartzetakis liked on 18th February 2020
C-Bass liked on 18th February 2020
Percy Mamedy liked on 18th February 2020
Carlos Hernandez retweeted on 18th February 2020
Carlos Hernandez liked on 18th February 2020
Simon Bennett liked on 17th February 2020
Laravel BAP retweeted on 17th February 2020
Jānis Lācis liked on 17th February 2020
Matheus Salmi liked on 17th February 2020
ᴅᴀᴠɪᴅ ᴅᴀʀᴋᴇ liked on 17th February 2020
lost.design liked on 17th February 2020
Devon Mather liked on 17th February 2020
Niels liked on 17th February 2020
George Kelly liked on 17th February 2020
Logan H. Craft liked on 17th February 2020
José Cage liked on 17th February 2020
Abdul Ghafar liked on 17th February 2020
KAAMA21 liked on 17th February 2020
Chris Oliver liked on 17th February 2020
Chris Döhring liked on 17th February 2020
{name: 'Luca Bockmann'} liked on 17th February 2020
Zubair Mohsin liked on 17th February 2020
Shaun Kidner liked on 17th February 2020
Efrain Salas liked on 17th February 2020
Marc Hampson liked on 17th February 2020
Vishwanath liked on 17th February 2020
Trường Phúc Võ liked on 17th February 2020
Florian Wartner liked on 17th February 2020
hjtshort retweeted on 17th February 2020
Matt Stauffer liked on 17th February 2020
Glöm aldrig Don Martin liked on 17th February 2020
Naitik Patel liked on 17th February 2020
Jordi WP liked on 17th February 2020
Denis Žoljom liked on 17th February 2020
Devan Koshal liked on 17th February 2020
Odinn Adalsteinsson liked on 17th February 2020
imzeeshan liked on 17th February 2020
Jeroen Nijhuis liked on 17th February 2020
Ahmet Mirzabeyoğlu liked on 17th February 2020
Yoan liked on 17th February 2020
Nandor Sperl liked on 17th February 2020
Jorge González liked on 17th February 2020
theonlyub liked on 17th February 2020
Mike liked on 17th February 2020
Salman Zafar liked on 17th February 2020
Antti Peisa retweeted on 17th February 2020
Spatie retweeted on 17th February 2020
Taylor Otwell 🏝 retweeted on 17th February 2020
Evert Ramos retweeted on 17th February 2020
Mitsutoshi Nakamura retweeted on 17th February 2020
Felipe Podestá liked on 17th February 2020
Antti Peisa liked on 17th February 2020
Evert Ramos liked on 17th February 2020
Miguel Piedrafita 🚀 liked on 17th February 2020
ugly computer t-shirts liked on 17th February 2020
Osama Khaled liked on 17th February 2020
Mitsutoshi Nakamura liked on 17th February 2020
Cody P. Christian liked on 17th February 2020
Hamza Bulat liked on 17th February 2020
Optimus liked on 17th February 2020
Richard van Baarsen liked on 17th February 2020