I'm trying to query a local Sybase database using NXLog and then write the output to a file.
So far I'm unable to connect to the database.
NXLog is saying that there are no drivers present.

I'm running this on Centos7.

I'm not seeing any database drivers available.
Do I need to download these drivers separately?
What's the name of the correct driver for Sybase?
Where would I find the correct file?

2020-03-09 12:02:18 INFO nxlog-ce-2.10.2150 started
2020-03-09 12:02:18 ERROR failed to open tmp/output;No such file or directory
2020-03-09 12:02:18 ERROR dbi_initialize failed, no drivers present?

Config below:

<Input dbi>
    Module  im_dbi
    Driver  Sybase
    Option  host
    Option  username ********
    Option  password ********
    Option  dbname ********
    SQL     SELECT * from *******
<Output file>
    Module  om_file
    File    "tmp/output.out"
<Route dbi_to_file>
    Path    dbi => file

Any help would be appreciated.

Thanks in advance!!

AskedMarch 9, 2020 - 5:07pm

Answer (1)

Please check this part from the nxlog user guide:

This mandatory directive specifies the name of the libdbi driver which will be used to connect to the
database. A DRIVER name must be provided here for which a loadable driver module exists under the name
libdbdDRIVER.so (usually under /usr/lib/dbd/). The MySQL driver is in the libdbdmysql.so file.

Maybe this article will be enough to get you going: https://www.devart.com/odbc/ase/docs/centos.htm

Comments (1)

  • casey1234's picture

    Hello Misaziv,
    Yes, I read that part of the documentation and other than telling me that the im_dbi module doesn't work out of the box it doesn't help me otherwise as I'm on Centos.

    libdbi needs drivers to access the database engines. These are in the libdbd-* packages on Debian and Ubuntu. 
    CentOS 5.6 has a libdbi-drivers RPM package, but this package does not contain any driver binaries under /usr/lib64/dbd.
     The drivers for both MySQL and PostgreSQL are in libdbi-dbd-mysql. If these are not installed, NXLog will return a libdbi driver initialization error.

    That second article you sited I think is actually for the im_odbc module which leverages ODBC which is different from im_dbi which leverages libdbi and the FreeTDS/Sybase/MySQL drivers (which libdbi lists as buggy and not supported on their website).

    Additionally to get this to work on Centos it appears that you need to download a C compiler on the system you plan to install on, download the drivers from libdbi, compile the drivers using special flags, configure the libdbi conf file, and then get it to work with NXLog.

    I have to admit that I had some serious challenges finding all of this information and would probably be helpful to others if this was better documented.

    To anyone seeing this trying to figure out how to make it work. Please bear in mind that I don't have much information about how to configure the drivers to work with NXLog as their documentation has very little about this particular setup. I'm also not sure where to tell the compiler to install the drivers (you have to tell it or it defaults to /usr/local/lib) but I suspect /usr/lib64/dbd. If you're running NXLog-EE then it looks like the NXLog team created a new module im_odbc in their EE version which appears to be better documented.

    Here's what I was able to find:

    Where to find the drivers
    How to compile the drivers
    A little more about how to compile but not as helpful

    It was decided to use a different tool for this so I never did get it working. Best of luck to those who attempt!