Using this rsyslog config:
$template MYFORMAT,"%msg%\n"
if $programname == 'mylog' then {
action(type="omfile" file="/var/log/mylog.log" template="MYFORMAT")
& stop
}
and this PHP script:
<?php
openlog('mylog', LOG_ODELAY, LOG_LOCAL0);
syslog(LOG_INFO, date('Y-m-d: ') . 'stuff has happened!');
closelog();
My output always ends up having an empty space before the logged message (in the custom log file).
2015-06-10: stuff has happened! (there's a space at the beginning of this line)