SQL om_dbi

Tags: #om_dbi

#1 Bohdan.Lisovskyi

Hi. How can I write SQL statement to the variable. For example: define variable $sql_statement = SELECT some_func() and in module om_dbi use this variable like Module om_dbi SQL $sql_statement Driver pgsql

#2 manuel.munozDeactivated Nxlog ✓
#1 Bohdan.Lisovskyi
Hi. How can I write SQL statement to the variable. For example: define variable $sql_statement = SELECT some_func() and in module om_dbi use this variable like Module om_dbi SQL $sql_statement Driver pgsql

Bohdan,

You need to use im_dbi instead of om_dbi. Result of query cannot be save to a variable, but you can use output modules to write it to a file.

<Input dbi>
Module im_dbi
Driver mysql
Option host 127.0.0.1
Option username mysql
Option password mysql
Option dbname logdb
SQL SELECT id, facility, severity, hostname, \
timestamp, application, message \
FROM log
</Input>
<Output file>
Module om_file
File "tmp/output"
</Output>
<Route dbi_to_file>
Path dbi => file
</Route>