Tailing a Log File on a Remote Server

Problem

You want to see the contents of your application's log file.

You'd like to view the log in real-time, seeing new entries as they occur.

Solution

Use the php artisan tail command.

Using the command by itself will display the contents of app/storage/logs/laravel.log in your local application.

$ php artisan tail
...
log contents
...

Press Ctrl+C to exit the log tail.

If you set up a remote connection in app/config/remote.php, you can use the tail command to view the log file on the remote machine.

$ php artisan tail remote-name
...
log contents
...

Press Ctrl+C to exit the log tail.

Discussion

For non-standard log files use the --path option.

$ php artisan tail --path=/full/path/to/log.file
comments powered by Disqus