[syslog-ng] Pipe() in syslog-ng ---- HELP

Khaleelah Peerbocus systems2 at maccs.mu
Tue Jul 13 13:00:52 CEST 2010


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 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 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?


-----Original Message-----
From: syslog-ng-bounces at lists.balabit.hu
[mailto:syslog-ng-bounces at lists.balabit.hu] On Behalf Of Balazs Scheidler
Sent: Tuesday, July 13, 2010 2:55 PM
To: Syslog-ng users' and developers' mailing list
Subject: Re: [syslog-ng] Pipe() in syslog-ng ---- HELP

On Tue, 2010-07-13 at 13:43 +0400, Khaleelah Peerbocus wrote:
> Hi
> 
>  
> 
> How can I avoid line breaks in syslog-ng when it is configured using 
> pipe
> 
>  
> 
> destination d_mssql {
> 
>         pipe("/tmp/mssql.syslog-ng.pipe" flags(no-multi-line)
> 
>     template("INSERT INTO
> logs(datetime,host,program,pid,message)VALUES('$R_DATE','$HOST','$PROG
> RAM','$PID','$MSGONLY');")
> 
>     template-escape(yes));
> 
> };
> 
>  
> 
> log {
> 
>      source(src);
> 
>      filter(f_debug);
> 
>      destination(d_mssql);
> 
> };
> 
>  
> 
>  
> 
> Then I have a script reading the pipe
> 
>  
> 
> if [ -e /tmp/mssql.syslog-ng.pipe ]; then
> 
>        while [ -e /tmp/mssql.syslog-ng.pipe ]
> 
>                 do
> 
>                        isql -v MSTEST  "sa" "password"
> < /tmp/mssql.syslog-ng.pipe
> 
>  
> 
>                 done
> 
> else
> 
>         mkfifo /tmp/mssql.syslog-ng.pipe
> 
> fi
> 
>  
> 
> Problem is the sql query is getting broken down in 3 lines
> 
>  

Where does it break? Can you also post an example?


--
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




More information about the syslog-ng mailing list