ommysql: MariaDB/MySQL Database Output Module

Module Name:

ommysql

Author:

Michael Meckelein (Initial Author) / Rainer Gerhards <rgerhards@adiscon.com>

Purpose

This module provides native support for logging to MariaDB/MySQL databases. It offers superior performance over the more generic omlibdbi module.

Configuration Parameters

Note

Parameter names are case-insensitive; camelCase is recommended for readability.

Action Parameters

Parameter

Summary

Server

Sets the MariaDB/MySQL server address the action connects to.

Socket

Sets the Unix socket path to use when connecting to the MariaDB/MySQL server.

db

Names the MariaDB/MySQL database that receives the log records.

UID

Defines the MariaDB/MySQL user account used for the connection.

PWD

Specifies the password for the MariaDB/MySQL user defined in UID.

ServerPort

Selects a non-standard port for the MariaDB/MySQL server connection.

MySQLConfig.File

Selects an optional MariaDB/MySQL client configuration file (my.cnf) for the connection.

MySQLConfig.Section

Chooses the section within the client configuration file specified by MySQLConfig.File.

Template

Specifies the template used to format log records for insertion into the MariaDB/MySQL database.

Examples

Example 1

The following sample writes all syslog messages to the database “syslog_db” on mysqlserver.example.com. The server is being accessed under the account of “user” with password “pwd”.

module(load="ommysql")
action(type="ommysql" server="mysqlserver.example.com" serverPort="1234"
       db="syslog_db" uid="user" pwd="pwd")

FAQ


Support: rsyslog Assistant | GitHub Discussions | GitHub Issues: rsyslog source project

Contributing: Source & docs: rsyslog source project

© 2008–2025 Rainer Gerhards and others. Licensed under the Apache License 2.0.