我有一个装有2个容器的吊舱:nginx和php-fpm。 我打算将php-fpm日志(确实记录到容器中)记录到stdout,以便可以在kibana上看到它们。
这是php-fpm容器内的一些信息表:
#env | grep -i log
APP_LOG_PATH=php://stdout
# php -i | grep -i log
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.17, Copyright (c) 1999-2018, by Zend Technologies
amqp.login => guest => guest
error_log => no value => no value
log_errors => Off => Off
log_errors_max_len => 1024 => 1024
mail.log => no value => no value
com_binlog_dump => 0
Classes => AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, CallbackFilterIterator, DirectoryIterator, DomainException, EmptyIterator, FilesystemIterator, FilterIterator, GlobIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, MultipleIterator, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveCallbackFilterIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RecursiveRegexIterator, RecursiveTreeIterator, RegexIterator, RuntimeException, SplDoublyLinkedList, SplFileInfo, SplFileObject, SplFixedArray, SplHeap, SplMinHeap, SplMaxHeap, SplObjectStorage, SplPriorityQueue, SplQueue, SplStack, SplTempFileObject, UnderflowException, UnexpectedValueException
opcache.error_log => no value => no value
opcache.log_verbosity_level => 1 => 1
APP_LOG_PATH => php://stdout
$_SERVER['APP_LOG_PATH'] => php://stdout
$_ENV['APP_LOG_PATH'] => php://stdout
Segmentation fault (core dumped)
#
试图在www.conf上取消注释(即日志所在的位置):
php_admin_value[error_log] = /var/www/html/logs/my-app.log
php_admin_flag[log_errors] = on
我唯一能得到的是与该过程有关的信息,例如“已重新启动”,“已启动”等。
我通过以下方式重新启动了php:
kill -USR2 1
但是这样做之后,无法在=>上打开log_errors =>。
任何帮助都会很棒,谢谢!
答案 0 :(得分:2)
在主php-fpm配置文件中将error_log = /dev/stdout
,access.log = /dev/stdout
和log_level
设置为所需的级别。可能在/etc/php/7.2/fpm/php-fpm.conf
或其他位置,具体取决于您的父docker映像。
答案 1 :(得分:1)
事实证明,我们需要在应用程序上更改一些与记录方式有关的内容。
完成后,由于这里的建议,我将能够获取日志。
欢呼