responses
hi,
Is somebody has got an experience of im_dbi ?
I tried this example but /tmp/output is filled of blank char ?
I checked nxlog log at starting, everything is OK.
Driver mysql has been installed correcly
<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>
Comments (5)
hello,
I tried my query and it's OK in my MySQL Query browser, it returns fews lines (I tried on a little table with 20 lines)
But, when I insert data in table, I can see that a blank line is insert in /tmp/output but nothing else happens. I excpected that the line inserted in the table should appear in /tmp/output.
I work on centos 7.2
iCirco,
Could you please post the result set from the query you ran?
My SQL Query :
SELECT id, nom FROM planbam;
128, 'd'
129, 'test'
130, 'test'
131, 'test'
132, 'test'
133, 'test'
134, 'test'
135, 'test'
136, 'test'
137, 'test'
138, 'test'
139, 'test'
140, 'test'
141, 'test'
142, 'test'
143, 'TEST'
144, 'TEST'
145, 'TEST'
146, 'TEST'
my nxlog.conf :
<Input dbi>
Module im_dbi
Driver mysql
Option host xx.xx.xx.xx
Option username xxx
Option password xxx
Option dbname test
SQL SELECT id, nom FROM planbam
</Input>
<Output file>
Module om_file
File "/tmp/output"
</Output>
<Route dbi_to_file>
Path dbi => file
</Route>
when I insert new line in planbam, /tmp/output is inserted of blank line (1 blank on each line)
Hello,
Did you try the settings that b0ti had mentioned below? Let us know the output of adding the json
Did you insert a line? I don't think so.
The record inserted comes back as fields that needs to be mapped to how output is written by om_file via
$raw_event
. You'll need to format the output usingxm_kvp
,xm_json
, etc.Try adding
Exec to_json();
to your output block and definexm_json
.