Parse SQL logs using NXLog, Logstash

1.3k views Asked by At

I want to send all logs from Database [Table creation, row insertion, data deletion, data selection etc.. ] to Logstash using NXLog, I have read the following blogs,

  1. Nxlog im_dbi is not working
  2. https://groups.google.com/forum/#!topic/logstash-users/t71AkNH5Ojc

But which seams to be not working for me. Any help will be highly appreciable.

My nxlog config file :

<Input sql-logs>        
    Module im_dbi
    SavePos TRUE
    Driver mysql
    Option dbname MySample
</Input>

<Output sql-out>
    Module      om_tcp
    Host        192.168.1.14
    Port        5222
</Output>

In logstash config file,

tcp {
    port => 5222
    type => "sqllogs"
}

Then I have created new table, inserted many records, but no logs visible in kibana.

1

There are 1 answers

0
b0ti On

You should first debug whether the sql-logs input actually works. I don't think it does. Check nxlog.log There is an SQL directive which specifies the select statement:

<Input sql-logs>        
    Module im_dbi
    SavePos TRUE
    Driver mysql
    Option dbname MySample
    SQL SELECT a, b as id FROM tbl
</Input>

Note that an id column must be present in the result set.