By embedded new line character you mean "\n"? It is at the end of the query destination d_mssql { pipe("/tmp/mssql.syslog-ng.pipe" template("INSERT INTO logs(datetime,host,program,pid,message)VALUES('$R_DATE','$HOST','$PROGRAM',' $PID','$MSGONLY');\n") template-escape(yes)); }; log { source(src); filter(f_debug); destination(d_mssql); }; Even if I remove the \n ..it does not work.. it gives the same output.. -----Original Message----- From: syslog-ng-bounces@lists.balabit.hu [mailto:syslog-ng-bounces@lists.balabit.hu] On Behalf Of Balazs Scheidler Sent: Tuesday, July 13, 2010 3:27 PM To: Syslog-ng users' and developers' mailing list Subject: Re: [syslog-ng] Pipe() in syslog-ng ---- HELP On Tue, 2010-07-13 at 15:00 +0400, Khaleelah Peerbocus wrote:
Hi
When I do a cat on the pipe just to see wats the output I get the following
INSERT INTO logs (datetime,host,program,pid,message) VALUES ( 'Jul 13 14:45:22', 'syslogng', 'agetty', '1316', '/dev/xvc0: No such file or directory'); INSERT INTO logs (datetime,host,program,pid,message) VALUES ( 'Jul 13 14:45:22', 'syslogng', 'agetty', '1316', '/dev/xvc0: No such file or directory'); INSERT INTO logs (datetime,host,program,pid,message) VALUES ( 'Jul 13 14:45:22', 'syslogng', 'agetty', '1316', '/dev/xvc0: No such file or directory'); INSERT INTO logs (datetime,host,program,pid,message) VALUES ( 'Jul 13 14:45:22', 'syslogng', 'agetty', '1316', '/dev/xvc0: No such file or directory'); INSERT INTO logs (datetime,host,program,pid,message) VALUES ( 'Jul 13 14:45:32', 'syslogng', 'init', '', 'Id \"x0\" respawning too fast: disabled for 5 minutes'); INSERT INTO logs (datetime,host,program,pid,message) VALUES ( 'Jul 13 14:45:32', 'syslogng', 'init', '', 'Id \"x0\" respawning too fast: disabled for 5 minutes'); INSERT INTO logs (datetime,host,program,pid,message) VALUES ( 'Jul 13 14:50:33', 'syslogng', 'agetty', '1318', '/dev/xvc0: No such file or directory'); INSERT INTO logs (datetime,host,program,pid,message) VALUES ( 'Jul 13 14:50:33', 'syslogng', 'agetty', '1318', '/dev/xvc0: No such file or directory'); INSERT INTO logs
And when the script is ran
I get the following errors
[ISQL]ERROR: Could not SQLPrepare SQL> [37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'logs'. [37000][unixODBC][FreeTDS][SQL Server]Statement(s) could not be prepared. [ISQL]ERROR: Could not SQLPrepare SQL> [37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'datetime'. [37000][unixODBC][FreeTDS][SQL Server]Statement(s) could not be prepared. [ISQL]ERROR: Could not SQLPrepare SQL> [37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near the SQL> keyword 'VALUES'. [37000][unixODBC][FreeTDS][SQL Server]Statement(s) could not be prepared. [ISQL]ERROR: Could not SQLPrepare SQL> [37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'logs'. [37000][unixODBC][FreeTDS][SQL Server]Statement(s) could not be prepared. [ISQL]ERROR: Could not SQLPrepare SQL> [37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'datetime'. [37000][unixODBC][FreeTDS][SQL Server]Statement(s) could not be prepared. [ISQL]ERROR: Could not SQLPrepareing SQL> [37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near the SQL> keyword 'VALUES'. [37000][unixODBC][FreeTDS][SQL Server]Statement(s) could not be prepared. [ISQL]ERROR: Could not SQLPrepare SQL> [37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'logs'. [37000][unixODBC][FreeTDS][SQL Server]Statement(s) could not be prepared.
So I guessed because it is processing each line independently.
Any idea?
don't you happen to have newline character in the template() option that you specified. I thought it was only because the mailer wrapped your lines, but seeing the actual output seems to indicate that you _do_ have embedded newline characters in the template itself. -- Bazsi ____________________________________________________________________________ __ Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng FAQ: http://www.campin.net/syslog-ng/faq.html