phpsyslog

Using syslog facilities with php error_log


Is posible use syslog facilities in php error_log directive or in other way at system/server side?

Something like...

error_log = syslog:local4
error_log = syslog(LOG_LOCAL4)

Using php fpm I can set this with syslog.facility directive in fpm conf, but what about of php cli?

Thanks


Solution

  • Php default syslog's facility is "user" (and cannot be changed)

    I use directive auto_prepend_file in phi.ini (this script must be under include_path)

    auto_prepend_file = log.php
    

    and

    root@sp:/etc/php5/cli# cat /usr/share/php5/log.php
    <?php
    
    openlog('php-cli', 0, LOG_LOCAL4);