Use this documentation with care! It describes
the heavily outdated version 5, which was actively
developed around 2010 and is considered dead by the
rsyslog team for many years now.
This documentation reflects the latest update of the
previously existing (now removed) v5-stable branch.
It describes the 5.10.2 version, which was never
released. As such, it contains some content that
does not apply to any released version.
To obtain the doc that properly matches your installed
v5 version, obtain the doc set from your distro. Each
version of rsyslog contained the version that exactly
matches it.
As general advise, it is strongly suggested to
upgrade to the current version supported by the rsyslog
project. The current version can always be found on
the right-hand side info box on the
rsyslog web site.
Note that there is no rsyslog community support available
for this heavily outdated version. If you need to stick
with it, please ask your distribution for support.
Module Name: ommysql
Author:Michael Meckelein (Initial Author) / Rainer Gerhards <rgerhards@adiscon.com>
Description:
This module provides native support for logging to MySQL databases. It offers superior performance over the more generic omlibdbi module.
Configuration Directives:
ommysql mostly uses the “old style” configuration, with almost everything on the action line itself. A few newer features are being migrated to the new style-config directive configuration system.
Note rsyslog contains a canned default template to write to the MySQL database. It works on the MonitorWare schema. This template is:
$template tpl,”insert into SystemEvents (Message, Facility, FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (‘%msg%’, %syslogfacility%, ‘%HOSTNAME%’, %syslogpriority%, ‘%timereported:::date-mysql%’, ‘%timegenerated:::date-mysql%’, %iut%, ‘%syslogtag%’)”,SQL
As you can see, the template is an actual SQL statement. Note the ”,SQL” option: it tells the template processor that the template is used for SQL processing, thus quote characters are quoted to prevent security issues. You can not assign a template without ”,SQL” to a MySQL output action.
If you would like to change fields contents or add or delete your own fields, you can simply do so by modifying the schema (if required) and creating your own custom template.
Sample:
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”.
$ModLoad ommysql $ActionOmmysqlServerPort 1234 # use non-standard port *.* :ommysql:mysqlserver.example.com,syslog_db,user,pwd
This documentation is part of the rsyslog project.
Copyright © 2008-2014 by Rainer Gerhards and Adiscon. Released under the GNU GPL version 3 or higher.