You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need some advice from more seasoned docker users.
I am extending the official php-image in my Dockerfile like this:
FROM php:5.6-apache
MAINTAINER "John Doe <Johndoe@dough.com>"
COPY ./templates/apache2files/piwik /var/www/html/
COPY ./templates/php.ini /usr/local/etc/php/
RUN chmod 777 -R /var/www/html/
RUN docker-php-ext-install mysqli
RUN docker-php-ext-install mbstring
I build the dockerfile with this:
docker build -t mypiwik
I run the container like this:
docker run -d --name mypiwikcontainer -p "8888:80" mypiwik:latest
I can see the access.log using this:
docker logs mypiwikcontainer
How can I see the error.log?????
Reacted by DMW007, supersv, Gabriele Formenti, Jan Szoja, Carlos Morales, strarsis, sushrest, Jiří Barouš, Reda, Quinn Bast and 4 more
What have you got in your logs? (docker logs mypiwikcontainer)
Currently I have the following (version 7.0-apache):
[core:warn] [pid 1] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
Therefore, there might be no file, unless I actually set this variable (currently investigation).
Also, you do not need to access the file. You can probably read it by connecting with ssh (docker exec -it mypiwikcontainer /bin/bash), and then access the right directory and use less or whatever is installed. I would personally use docker logs and am trying to get into the log drivers to centralise logs to a central graylog instance.
Reacted by keltik85, Denys Bushuliak, Donovan Chandler, Jason McVetta, David Tiselius, Maksym Rykin, Travis Tomka, Chris Wall, shamil8124, Tomek Romik and 136 more
Reacted by Carlos Afonso, Michele Lacchia, Aleks Volochnev, Oliver Lluberes and Kamil Karkoszka
Reacted by Nathan S. Martins, Dominic Dambrogia, sklochko-id, Konstantin Möllers, Christoph Wurst, Stéphane, Mykola Veryha, mohsen hosseini, Michaël Rivet, Quentin and 23 more
@povils Container apps shouldn't write log files in the container, as its lifecycle is meant to be "disposable", unless you mount a volume and want them on your file system. This is a core tenet of the 12-factor-app methodology.
If you docker exec -it app-name ls -alh /var/log/apache2/ you will see the log files are symlinked to /dev/stderr and /dev/stdout as they should. This allows the container engine to expose logs via the docker logs -f app-name command or an orchestrator like Swarm or Kubernetes to expose them to centralized logging like ELK stack or Stackdriver.
Reacted by Vadim Sluzky, Stéphane Lavergne, Frederico Martini, Raptor, alwinmarkcf, Oliver Radwell, Craig Wayne, raknjak, abdulladev1995, Derek and 4 more
I believe you enable fluentd and configure logging output. The ephemeral nature of containers is meant to stream logs not write them so you need to capture the stream one layer up, then ship em.
On Oct 20, 2017, at 2:51 AM, Povilas Susinskas ***@***.***> wrote:
@mikesparr Thanks for the answer. I needed log files because I am using Elastic Filebeat which harvests log files and streams that to our ELK
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
Activity
tdutrion commentedon Apr 1, 2016
Hi,
What have you got in your logs? (
docker logs mypiwikcontainer)Currently I have the following (version 7.0-apache):
Therefore, there might be no file, unless I actually set this variable (currently investigation).
Also, you do not need to access the file. You can probably read it by connecting with ssh (
docker exec -it mypiwikcontainer /bin/bash), and then access the right directory and use less or whatever is installed. I would personally usedocker logsand am trying to get into the log drivers to centralise logs to a central graylog instance.blueimp commentedon Apr 2, 2016
@keltik85
I had the same issue and solved it the following way:
In your
php.ini, add the following lines:Now you'll be able to see any PHP error logs as part of the docker container log stream:
To display only errors and hide the access log, you can pipe
stdoutto/dev/null:docker logs -f your_php_apache_container >/dev/nullTo follow only the access log, you can pipe
stderrto/dev/null:docker logs -f your_php_apache_container 2>/dev/nullpovils commentedon May 17, 2017
It's cool, but how to get actual log files?
Raaghu commentedon May 29, 2017
check that 000-default site is enabled for your apache,
in my case
/etc/apache2/sites-enabled/does not contained softlink to000-default.confso I ran
then i started seeing logs in access.log and error.log
mikesparr commentedon Oct 20, 2017
@povils Container apps shouldn't write log files in the container, as its lifecycle is meant to be "disposable", unless you mount a volume and want them on your file system. This is a core tenet of the 12-factor-app methodology.
If you
docker exec -it app-name ls -alh /var/log/apache2/you will see the log files are symlinked to/dev/stderrand/dev/stdoutas they should. This allows the container engine to expose logs via thedocker logs -f app-namecommand or an orchestrator like Swarm or Kubernetes to expose them to centralized logging like ELK stack or Stackdriver.povils commentedon Oct 20, 2017
@mikesparr Thanks for the answer. I needed log files because I am using Elastic Filebeat which harvests log files and streams that to our ELK
mikesparr commentedon Oct 20, 2017
okainov commentedon May 11, 2019
@blueimp thanks, works perfectly! I wonder, why isn't it included into default PHP Docker image....
buster95 commentedon Apr 23, 2020
I solved this problem adding next command in dockerfile
RUN cp $PHP_INI_DIR/php.ini-development $PHP_INI_DIR/php.iniVideles commentedon Apr 26, 2022
This works like a charms, thanks a lot!