We have implemented centralised logging using syslog-ng on our load balanced servers. The history of that setup can be seen here: How do I set up PHP Logging to go to a remote server? .
It's working fine but the newlines are getting stripped at the destination. Is there any way to keep the newlines intact? Here's our config:
Source
destination php { tcp("server.com" port(xxxx)); };
log { source(s_all); filter(f_php); destination(php); };
filter f_php { facility(user); };
Destination
destination d_php { file("$PROGRAM" owner(www-data) group(www-data) perm(0644)); };
filter f_php { program("^\/var\/log\/"); };
log { source(s_all); filter(f_php); destination(d_php); flags(final); };
You can change the syslog template format for the destination and manually add the newline at the end. For example, here's a template I use for one of my customized syslog-ng streams. I change the date format (to be more easily parsed by a script). Notice the " " at the end.
file("$PROGRAM"
template("$R_ISODATE $HOST_FROM $MSGHDR$MSG
")
template_escape(no)
);
See the syslog-ng docs for information on the various $VARS
you can use.