Laravel 5.6 and Docker logs

Behrouz hasanbeygi
1 min readNov 3, 2018

--

in my previous post i show how to send docker json log to elk by gelf log driver , but first of all we need send php error or message logs to stdout or stderror. by default official php image send logs to stdout but i use alpine image for create my base nginx + php docker image

there is three way

first one change php.ini setting and send php error to /dev/stdout and in change laravel log channel to stderror ( log channel introduce in laravel 5.6 )

second one linking php-fpm error log file to /dev/stderror and change laravel log channel to stderror and change php-fpm pool configuration to show admin log ( php 7.2 have a little bug and show logs after php-fpm child information )

third one use single old style laravel log and when you creating your Dockerfile , soft linking storage/log/laravel.log to /dev/stderror

i put all my examples in gist you can see below

--

--