ClickHouse

简介

flusher_clickhouse flusher插件可以实现将采集到的数据,经过处理后,发送到 ClickHouse,需要 ClickHouse 版本至少为 22.3

版本

Alpha

配置参数

参数类型是否必选说明

Addresses

String数组

ClickHouse 地址

Convert

Struct

ilogtail数据转换协议配置

Convert.Protocol

String

ilogtail数据转换协议,kafka flusher 可选值:custom_single,otlp_log_v1。默认值:custom_single

Convert.Encoding

String

ilogtail flusher数据转换编码,可选值:jsonnoneprotobuf,默认值:json

Convert.TagFieldsRename

Map

对日志中tags中的json字段重命名

Convert.ProtocolFieldsRename

Map

ilogtail日志协议字段重命名,可当前可重命名的字段:contents,tagstime

Authentication

Struct

Clickhouse 连接访问认证配置

Authentication.PlainText.Username

String

ClickHouse 用户名

Authentication.PlainText.Password

String

ClickHouse 密码

Authentication.PlainText.Database

String

插入数据目标数据库名称

Authentication.TLS.Enabled

Boolean

是否启用 TLS 安全连接,

Authentication.TLS.CAFile

String

TLS CA 根证书文件路径

Authentication.TLS.CertFile

String

TLS 连接证书文件路径

Authentication.TLS.KeyFile

String

TLS 连接私钥文件路径

Authentication.TLS.MinVersion

String

TLS 支持协议最小版本,可选配置:1.0, 1.1, 1.2, 1.3,默认:1.2

Authentication.TLS.MaxVersion

String

TLS 支持协议最大版本,可选配置:1.0, 1.1, 1.2, 1.3,默认采用:crypto/tls支持的版本,当前1.3

Cluster

String

数据库对应集群名称

Table

String

插入数据目标 null engine 数据表名称

MaxExecutionTime

Int

单次请求最长执行时间,默认 60 秒

DialTimeout

String

Dial 超时时间,默认 10 秒

MaxOpenConns

Int

最大连接数,默认 5

MaxIdleConns

Int

连接池连接数,默认 5

ConnMaxLifetime

String

连接维持最大时长,默认 10 分钟

BufferNumLayers

Int

Buffer 缓冲区数量,默认 16

BufferMinTime

Int

缓冲区数据刷新限制条件 min_time,默认 10

BufferMaxTime

Int

缓冲区数据刷新限制条件 max_time,默认 100

BufferMinRows

Int

缓冲区数据刷新限制条件 min_rows,默认 10000

BufferMaxRows

Int

缓冲区数据刷新限制条件 max_rows,默认 1000000

BufferMinBytes

Int

缓冲区数据刷新限制条件 min_bytes,默认 10000000

BufferMaxBytes

Int

缓冲区数据刷新限制条件 max_bytes,默认 100000000

Compression

String

压缩方式,默认 lz4,可选 none/gzip/deflate/lz4/br/zstd

样例

采集/home/test-log/路径下的所有文件名匹配*.log规则的文件,并将采集结果发送到 ClickHouse。

enable: true
inputs:
  - Type: file_log
    LogPath: /home/test_log
    FilePattern: "*.log"
flushers:
  - Type: flusher_clickhouse
    Addresses: 
      - 192.XX.XX.1:9092
      - 192.XX.XX.2:9092
    Authentication:
      PlainText:
        Database: default
        Username: user
        Password: 123456
    Table: demo

Last updated