Configure (r)syslogd vim /etc/rsyslog.d/99-custom-logging.conf
if $syslogfacility-text == 'local6' and $programname == 'log1' then /var/log/log1.log
if $syslogfacility-text == 'local6' and $programname == 'log1' then ~
if $syslogfacility-text == 'local7' and $programname == 'log2' then /var/log/log2.log
if $syslogfacility-text == 'local7' and $programname == 'log2' then ~
The logging code in PHP
openlog("gateway", LOG_PID|LOG_NDELAY, LOG_LOCAL6);
syslog(LOG_INFO, "Test message");
The logging results
tail -f /var/log/log1.log
May 25 21:23:35 thor log1[4354]: test3
Comments
blog comments powered by Disqus