omclickhouse: ClickHouse Output Module¶
Module Name: |
omclickhouse |
Author: |
Pascal Withopf <pwithopf@adiscon.com> |
Purpose¶
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¶
Note
Parameter names are case-insensitive; camelCase is recommended for readability.
Action Parameters¶
Parameter |
Summary |
|---|---|
Allows connections to servers that present unsigned TLS certificates. |
|
Determines whether events are sent individually or batched together in bulk HTTP requests. |
|
Specifies a file that receives bulk-mode failures along with the ClickHouse error response. |
|
Sets the timeout, in milliseconds, for verifying ClickHouse availability. |
|
Limits the maximum size of a bulk HTTP request when |
|
Sets the HTTP port used to connect to the ClickHouse server. |
|
Provides the password for HTTP basic authentication when required by ClickHouse. |
|
Specifies the address of the ClickHouse server that receives events from this action. |
|
Controls whether the module disables host name verification for HTTPS connections. |
|
Selects the message template that renders the INSERT statement sent to ClickHouse. |
|
Configures the send timeout, in milliseconds, for ClickHouse HTTP requests. |
|
Controls whether HTTPS is used by default when no scheme is specified for the ClickHouse server. |
|
Sets the username for HTTP basic authentication against ClickHouse. |
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 an 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).
Examples¶
Example 1¶
The following sample does the following:
loads the omclickhouse module
outputs all logs to ClickHouse using the default settings
module(load="omclickhouse")
action(type="omclickhouse")
Example 2¶
In this example the URL will use http and the specified parameters to create the REST URL.
module(load="omclickhouse")
action(type="omclickhouse" server="127.0.0.1" port="8124" user="user1" pwd="pwd1"
useHttps="off")
Example 3¶
This example will send messages in batches up to 10MB. If an error occurs it will be written in the error file.
module(load="omclickhouse")
action(type="omclickhouse" maxBytes="10mb" errorFile="clickhouse-error.log")
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.