[syslog-ng] Problem instert data MSSQL

Fekete Róbert frobert at balabit.hu
Wed Dec 14 20:45:16 CET 2011


Hi, 

have you tried using the native syslog-ng mssql driver?
It is available in syslog-ng 3.x (I think).

https://www.balabit.com/sites/default/files/documents/syslog-ng-ose-3.3-guides/syslog-ng-ose-v3.3-guide-admin-en.html/configuring_destinations_sql.html

Robert

 
On Wednesday, December 14, 2011 12:10 CET, Bely Silva Junior <bjuniow at gmail.com> wrote: 
 
> hi
> 
> i have problem when i try insert data in mssql server, when i try run
> script, just 2 or 3 lines insert ok, but , insert  stop .
> 
> I use pipe, my confs.
> 
> destination d_mssql {
>     pipe("/var/mssql.syslog-ng.pipe"
>    template( "INSERT INTO logs (host, facility, priority, level, tag,
> datetime, program, msg ) VALUES (
> '$HOST','$FACILITY','$PRIORITY','$LEVEL','$TAG','$YEAR-$MONTH-$DAY
> $HOUR:$MIN:$SEC','$PROGRAM','$MSG' );\n" ) template-escape(yes));
>   template-escape(yes));
> };
> 
> 
> log {
>       source(s_all);
>       destination(d_mssql);
> };
> 
> my script:
> 
> if [ -e /var/mssql.syslog-ng.pipe ]; then
>        while [ -e /var/mssql.syslog-ng.pipe ]
>                 do
>                     #isql -v MSSQL "syslogng" "h0hYgbDB6Q" <
> /var/mssql.syslog-ng.pipe > /dev/null
>                     isql -v MSSQL "syslogng" "h0hYgbDB6Q" <
> /var/mssql.syslog-ng.pipe
>                done
> else
> 
>         mkfifo /var/mssql.syslog-ng.pipe
> fi
> 
> 
> 
> when i try run script:
> 
> ./syslog2mssql.sh
> +---------------------------------------+
> | Connected!                            |
> |                                       |
> | sql-statement                         |
> | help [tablename]                      |
> | quit                                  |
> |                                       |
> +---------------------------------------+
> SQL> SQLRowCount returns 1
> SQL> +------------+
> |            |
> +------------+
> +------------+
> SQLRowCount returns 0
> SQL> SQLRowCount returns -1
> SQL> SQLRowCount returns 1
> SQL> [ISQL]ERROR: Could not SQLPrepare
> SQL> [ISQL]ERROR: Could not SQLPrepare./syslog2mssql.sh
> +---------------------------------------+
> | Connected!                            |
> |                                       |
> | sql-statement                         |
> | help [tablename]                      |
> | quit                                  |
> |                                       |
> +---------------------------------------+
> SQL> SQLRowCount returns 1
> SQL> +------------+
> |            |
> +------------+
> +------------+
> SQLRowCount returns 0
> SQL> SQLRowCount returns -1
> SQL> SQLRowCount returns 1
> SQL> [ISQL]ERROR: Could not SQLPrepare
> SQL> [ISQL]ERROR: Could not SQLPrepare
> 
> 
> 
> someone have idea for this ?
> 
> 
> -- 
> Bely Silva Junior
 
 
 
 




More information about the syslog-ng mailing list