Skip to content

Problems with outputs.sql.convert using clickhouse driver #13368

Closed as not planned
@timetofaceit

Description

Relevant telegraf.conf

[[outputs.sql]]
  driver = "clickhouse"
  data_source_name = "tcp://MY_IP:9000?username=user&password=pass&database=database"
  table_template = "CREATE TABLE IF NOT EXISTS {TABLE}({COLUMNS}) ENGINE = MergeTree() PRIMARY KEY (timestamp,host) ORDER by (timestamp,host) Partition by toYYYYMMDD(timestamp)"
  table_exists_template = "SELECT 1 FROM {TABLE} LIMIT 1"
  [outputs.sql.convert]
    integer = "Int64"
    real = "Float64"
    text = "String"
    timestamp = "DateTime"
    defaultvalue = "String"
    unsigned = "UInt64"
    bool = "UInt8"

Logs from Telegraf

[agent] Error writing to outputs.sql: code: 62, message: Syntax error: failed at position 133 ('UInt64'): UInt64,"err_out" Int64 UInt64,"drop_in" Int64 UInt64,"drop_out" Int64 UInt64,"bytes_sent" Int64 UInt64,"bytes_recv" Int64 UInt64,"packets_sent" Int64 UInt64,"pa. Expected one of: COLLATE, NOT, NULL, DEFAULT, MATERIALIZED, ALIAS, EPHEMERAL, AUTO_INCREMENT, COMMENT, CODEC, TTL, token, Comma, ClosingRoundBracket

System info

Telegraf version - 1.26.3, Clickhouse version - 23.4.2.11

Steps to reproduce

  1. Start collecting metrics with Telegraf;
  2. Telegraf fails to send metrics with the error above.

Expected behavior

Telegraf creates Database Tables automatically and sends metrics.

Actual behavior

Telegraf fails with error above.

Additional info

Seems to be the same problem that was couple of years back - #10671, #10673

Metadata

Assignees

No one assigned

    Labels

    bugunexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions