tech687
(Tech687)
#1
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy
~$ php -v
PHP 8.1.2-1ubuntu2.9 (cli) (built: Oct 19 2022 14:58:09) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2-1ubuntu2.9, Copyright (c), by Zend Technologies
~$ docker run php php -v
PHP 8.1.12 (cli) (built: Nov 15 2022 04:42:55) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.12, Copyright (c) Zend Technologies
~$ grep log-driver /etc/docker/daemon.json
"log-driver": "syslog",
~$ docker run php php -r 'syslog(LOG_ERR, "ABC123");'
~$ cut -d ' ' -f6 /var/log/syslog | grep ABC123 || echo NOT FOUND
NOT FOUND
Why?
And in any case outside docker works
~$ php -r 'syslog(LOG_ERR, "ABC123");'
~$ cut -d ' ' -f6 /var/log/syslog | grep ABC123 || echo NOT FOUND
ABC123
rimelek
(Ákos Takács)
#2
For the same reason why the logger command didn’t work
There is no syslog in the container. Since I obiously failed to explain it in the other topic, I hope someone else will find a better way to do it.
tech687
(Tech687)
#3
Ok, in other words, the syslog() php function does not take advantage of the docker logging driver