I was trying to put data from kafka to clickhouse with filebeat, my configs looks like below
filebeat conf
filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/nginx/access.log
output.kafka:
# specifying filebeat to take timestamp and message fields, other wise it
# take the lines as json and publish to kafka
codec.format:
string: '%{[@timestamp]} %{[message]}'
# kafka
# publishing to 'log' topic
hosts: ["kafka:9092"]
topic: 'myfirst'
partition.round_robin:
reachable_only: false
required_acks: 1
compression: gzip
max_message_bytes: 1000000
in the Kafka im getting my log in topic and Everything is fine, a part that the data are inserted to kafka topic like this
2021-01-01T21:51:25.225Z {"remote_addr": "192.168.222.1","remote_user": "-","time_local": "01/Jan/2021:21:51:17 +0000","request": "GET / HTTP/1.1","status": "304","body_bytes_sent": "0","http_referer": "-","http_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"}
and i create clickhouse tables and MATERIALIZED
CREATE TABLE accesslog (
...
) ENGINE = Kafka SETTINGS kafka_broker_list = 'kafka:9092',
but query output in clickhouse was like this without data!why?
┌─remote_addr─┬─remote_user─┬─time_local─┬───────date─┬─request─┬─status─┬─body_bytes_sent─┬─http_referer─┬─http_user_agent─┐
│ │ │ │ 0000-00-00 │ │ 0 │ 0 │ │ │
│ │ │ │ 0000-00-00 │ │ 0 │ 0 │ │ │
│ │ │ │ 0000-00-00 │ │ 0 │ 0 │ │ │
└─────────────┴─────────────┴────────────┴────────────┴─────────┴────────┴─────────────────┴──────────────┴─────────────────┘