template

Selects the message template that renders the INSERT statement sent to ClickHouse.

This parameter applies to omclickhouse: ClickHouse Output Module.

Name:

template

Scope:

input

Type:

word

Default:

`` StdClickHouseFmt``

Required?:

no

Introduced:

not specified

Description

This is the message format that will be sent to ClickHouse. With the default format="values", the rendered string must be an INSERT statement. For format="values", custom INSERT templates must enable option.sql="on" in RainerScript. ClickHouse accepts backslash escape sequences inside string literals, so option.stdsql="on" is not safe for this module. These are template-level options, not omclickhouse action parameters. Only string and list templates apply SQL escaping to rendered fields; plugin and subtree templates are rejected for this action even if they declare option.sql="on".

With format="jsoneachrow", the template renders one JSON object per event. Use a list template with option.jsonf="on", or escape each field with a property option such as :::json. option.stdsql, option.sql, and option.json are rejected. The module puts the INSERT in the request URL. Defaults to:

Note

The leading space in `` StdClickHouseFmt`` is intentional. Rsyslog registers its built-in templates with a leading space in the internal configuration state, and the module looks up the default by that exact name. When overriding the parameter yourself, use the natural form StdClickHouseFmt (without the space) as shown below.

"\"INSERT INTO rsyslog.SystemEvents (severity, facility, "
"timestamp, hostname, tag, message) VALUES ("
"%syslogseverity%, %syslogfacility%, "
"'%timereported:::date-unixtimestamp%', '%hostname%', "
"'%syslogtag%', '%msg%')\""

Input usage

module(load="omclickhouse")
template(name="CustomClickHouseFmt" type="string" option.sql="on"
         string="INSERT INTO rsyslog.SystemEvents (severity, facility, timestamp, hostname, tag, message) VALUES (%syslogseverity%, %syslogfacility%, '%timereported:::date-unixtimestamp%', '%hostname%', '%syslogtag%', '%msg%')")
action(type="omclickhouse" template="CustomClickHouseFmt")

See also

See also omclickhouse: ClickHouse Output Module.


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

Contributing: Source & docs: rsyslog source project

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