NXLog Docs

EventDB (om_eventdb)

This custom output module uses libdrizzle to insert log message data into a MySQL database with a special schema. It also supports Unix domain socket connections to the database for faster throughput.

Configuration

The om_eventdb module accepts the following directives in addition to the common module directives. The DBname, Password, and UserName directives are required along with one of Host and UDS.

DBname

Name of the database to read the logs from.

Host

This specifies the IP address or a DNS hostname the module should connect to (the hostname of the MySQL server). This directive cannot be used with UDS.

Password

Password for authenticating to the database server.

UDS

For Unix domain socket connections, this directive can be used to specify the path of the socket such as /var/run/mysqld.sock. This directive cannot be used with the Host and Port directive.

UserName

Username for authenticating to the database server.


BulkLoad

If set to TRUE, this optional boolean directive instructs the module to use a bulk-loading technique to load data into the database; otherwise traditional INSERT statements are issued to the server. The default is TRUE.

LoadInterval

This directive specifies how frequently bulk loading should occur, in seconds. It can be only used when BulkLoad is set to TRUE. The default bulk load interval is 20 seconds.

Port

This specifies the port the module should connect to, on which the database is accepting connections. This directive cannot be used with UDS. The default is port 3306.

TempDir

This directive sets a directory where temporary files are written. It can be only used when BulkLoad is set to TRUE. If this directive is not specified, the default directory is /tmp. If the chosen directory does not exist, the module will try to create it.

Examples

Example 1. Storing Logs in an EventDB Database

This configuration accepts log messages via TCP in the NXLog binary format and inserts them into a database using libdrizzle.

nxlog.conf
<Input tcp>
    Module      im_tcp
    ListenAddr  localhost:2345
    InputType   Binary
</Input>

<Output eventdb>
    Module      om_eventdb
    Host        localhost
    Port        3306
    Username    joe
    Password    secret
    Dbname      eventdb_test2
</Output>

<Route tcp_to_eventdb>
    Path        tcp => eventdb
</Route>