diff options
author | Tim Eifler <teifler@adiscon.com> | 2012-10-01 12:17:47 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-10-01 12:17:47 +0200 |
commit | 819c8167414a5056fb6a87b4b38ce656c78d5897 (patch) | |
tree | 0543e64c06b0904318b8e3c5da12e7e3f661aca8 | |
parent | 11c203c6732ebe939571919ee85f414f0457a017 (diff) | |
download | rsyslog-819c8167414a5056fb6a87b4b38ce656c78d5897.tar.gz rsyslog-819c8167414a5056fb6a87b4b38ce656c78d5897.tar.bz2 rsyslog-819c8167414a5056fb6a87b4b38ce656c78d5897.zip |
doc: add SQL-template example
-rw-r--r-- | doc/rsyslog_conf_templates.html | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/rsyslog_conf_templates.html b/doc/rsyslog_conf_templates.html index b5aa687a..3e4bceeb 100644 --- a/doc/rsyslog_conf_templates.html +++ b/doc/rsyslog_conf_templates.html @@ -302,6 +302,35 @@ Note that the template string itself must be on a single line. string="<%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% %syslogtag:1:32%%msg:::sp-if-no-1st-sp%%msg%" )</code></pre> Note that the template string itself must be on a single line. + +<h4>Standard Template for write to the MySQL database</h4> +<p><pre><code>template(name="StdSQLformat" type="list" option.sql="on") { + constant(value="insert into SystemEvents (Message, Facility, FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag)") + constant(value=" values ('") + property(name="msg") + constant(value="', ") + property(name="syslogfacility") + constant(value=", '") + property(name="hostname") + constant(value="', ") + property(name="syslogpriority") + constant(value=", '") + property(name="timereported" dateFormat="mysql") + constant(value="', '") + property(name="timegenerated" dateFormat="mysql") + constant(value="', ") + property(name="iut") + constant(value=", '") + property(name="syslogtag") + constant(value="')") + } +</code></pre> +<p>The equivalent string template looks like this: +<br><pre><code>template(name="stdSQLformat" type="string" option.sql="on" + string="insert into SystemEvents (Message, Facility, FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values ('%msg%', %syslogfacility%, '%HOSTNAME%', %syslogpriority%, '%timereported:::date-mysql%', '%timegenerated:::date-mysql%', %iut%, '%syslogtag%')" +)</code></pre> +Note that the template string itself must be on a single line. + <h2>legacy format</h2> <p>In pre v6-versions of rsyslog, you need to use the <code>$template</code> statement to configure templates. They provide the equivalent to string- and |