RSyslog Documentation

omclickhouse: ClickHouse Output Module

Module Name:omclickhouse
Author:Pascal Withopf <>


This module provides native support for logging to ClickHouse. To enable the module use “–enable-clickhouse” while configuring rsyslog. Tests for the testbench can be enabled with “–enable-clickhouse-tests”.

Notable Features

Configuration Parameters


Parameter names are case-insensitive.

Action Parameters


typedefaultmandatoryobsolete legacy directive

The address of a ClickHouse server.


typedefaultmandatoryobsolete legacy directive

HTTP port to use to connect to ClickHouse.


typedefaultmandatoryobsolete legacy directive

Default scheme to use when sending events to ClickHouse if none is specified on a server.


typedefaultmandatoryobsolete legacy directive

This is the message format that will be sent to ClickHouse. The resulting string needs to be a valid INSERT Query, otherwise ClickHouse will return an error. Defaults to:

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


typedefaultmandatoryobsolete legacy directive

The “off” setting means logs are shipped one by one. Each in its own HTTP request. The default “on” will send multiple logs in the same request. This is recommended, because it is many times faster than when bulkmode is turned off. The maximum number of logs sent in a single bulk request depends on your maxbytes and queue settings - usually limited by the dequeue batch size. More information about queues can be found here.


typedefaultmandatoryobsolete legacy directive

When shipping logs with bulkmode on, maxbytes specifies the maximum size of the request body sent to ClickHouse. Logs are batched until either the buffer reaches maxbytes or the dequeue batch size is reached.


typedefaultmandatoryobsolete legacy directive

If you have basic HTTP authentication deployed you can specify your user-name here.


typedefaultmandatoryobsolete legacy directive
word nonone

Password for basic authentication.


typedefaultmandatoryobsolete legacy directive

If specified, records failed in bulk mode are written to this file, including their error cause. Rsyslog itself does not process the file any more, but the idea behind that mechanism is that the user can create a script to periodically inspect the error file and react appropriately. As the complete request is included, it is possible to simply resubmit messages from that script.

Please note: when rsyslog has problems connecting to clickhouse, a general error is assumed. However, if we receive negative responses during batch processing, we assume an error in the data itself (like a mandatory field is not filled in, a format error or something along those lines). Such errors cannot be solved by simply resubmitting the record. As such, they are written to the error file so that the user (script) can examine them and act appropriately. Note that e.g. after search index reconfiguration (e.g. dropping the mandatory attribute) a resubmit may be successful.


typedefaultmandatoryobsolete legacy directive

The module accepts connections to servers, which have unsigned certificates. If this parameter is disabled, the module will verify whether the certificates are authentic.


typedefaultmandatoryobsolete legacy directive

If “on”, this will set the curl CURLOPT_SSL_VERIFYHOST option to 0. You are strongly discouraged to set this to “on”. It is primarily useful only for debugging or testing.


typedefaultmandatoryobsolete legacy directive

This parameter sets the timeout for checking the availability of ClickHouse. Value is given in milliseconds.


typedefaultmandatoryobsolete legacy directive

This parameter sets the timeout for sending data to ClickHouse. Value is given in milliseconds.

Statistic Counter

This plugin maintains global statistics, which accumulate all action instances. The statistic is named “omclickhouse”. Parameters are:

  • submitted - number of messages submitted for processing (with both success and error result)
  • fail.httprequests - the number of times a http request failed. Note that a single http request may be used to submit multiple messages, so this number may be (much) lower than failed.http.
  • failed.http - number of message failures due to connection like-problems (things like remote server down, broken link etc)
  • fail.clickhouse - number of failures due to clickhouse error reply; Note that this counter does NOT count the number of failed messages but the number of times a failure occurred (a potentially much smaller number). Counting messages would be quite performance-intense and is thus not done.
  • response.success - number of records successfully sent in bulk index requests - counts the number of successful responses

The fail.httprequests and failed.http counters reflect only failures that omclickhouse detected. Once it detects problems, it (usually, depends on circumstances) tell the rsyslog core that it wants to be suspended until the situation clears (this is a requirement for rsyslog output modules). Once it is suspended, it does NOT receive any further messages. Depending on the user configuration, messages will be lost during this period. Those lost messages will NOT be counted by impstats (as it does not see them).


Example 1

The following sample does the following:

  • loads the omclickhouse module
  • outputs all logs to ClickHouse using the default settings

Example 2

In this example the URL will use http and the specified parameters to create the REST URL.

action(type="omclickhouse" server="" port="8124" user="user1" pwd="pwd1"

Example 3

This example will send messages in batches up to 10MB. If an error occurs it will be written in the error file.

action(type="omclickhouse" maxbytes="10mb" errorfile="clickhouse-error.log")

See also

Help with configuring/using Rsyslog:

  • Mailing list - best route for general questions
  • GitHub: rsyslog source project - detailed questions, reporting issues that are believed to be bugs with Rsyslog
  • Stack Exchange (View, Ask) - experimental support from rsyslog community

See also

Contributing to Rsyslog:

Copyright 2008-2020 Rainer Gerhards (Großrinderfeld), and Others.

Scroll to top