Apache 如何将日志内容发送到程序?

Apache 如何将日志内容发送到程序?,apache,httpd.conf,error-logging,Apache,Httpd.conf,Error Logging,httpd.conf指令中的About apache2(CentOS中的httpd)可以创建如下自定义日志: ErrorLog "|rotatelogs /var/log/httpd/error_log_%Y-%m 1G" 资料来源: 因此,我得出结论,可以将日志内容发送到您看到的一个程序,然后将其写入文件,我将创建一个程序,将内容存储在数据库中,以便将来进行复杂的咨询,我如何做到这一点 我以这种方式进行了尝试,但没有结果: ErrorLog "|php /etc/httpd/log2sql.

httpd.conf指令中的About apache2(CentOS中的httpd)可以创建如下自定义日志:

ErrorLog "|rotatelogs /var/log/httpd/error_log_%Y-%m 1G"
资料来源:

因此,我得出结论,可以将日志内容发送到您看到的一个程序,然后将其写入文件,我将创建一个程序,将内容存储在数据库中,以便将来进行复杂的咨询,我如何做到这一点

我以这种方式进行了尝试,但没有结果:

ErrorLog "|php /etc/httpd/log2sql.php"
在脚本中,我检查:

<?php
file_put_contents('/var/log/httpd/log2sql', "\n".print_r($argv, true)."\n--------------", FILE_APPEND);
exit(0);
和日志:

Array
(
    [0] => /etc/httpd/log2sql.php
)

---------
没有论据:(

Array
(
    [0] => /etc/httpd/log2sql.php
)

---------