I am using syslog-ng(latest version 3.30) and kafka(2.2)
- syslog-ng and kafka is running in 3 nodes
- Client send logs to multiple syslog-ng nodes
- syslog-ng nodes send these logs to kafka broker
- For kafka syslog-ng is producer
The problem i am facing is that multiple syslog-ng who act as a producer are sending the same data to the topic. In kafka topic if one client is sending message like ABC to multiple syslog-ng then all the nodes of syslog-ng receive the same message ABC and producers(multiple syslog-ng nodes) send ABC message to the kafka so there will 3 ABC message
@define kafka-implementation kafka-c
#############################################
source s_network_udp {
network(
transport("udp")
port(514)
);
};
#############################################
rewrite test {
set(
"test",
value("tags")
);
};
#############################################
destination pfsense_kafka
{
kafka (
bootstrap-servers("xx.xx.xx.xx:9092")
topic("logs")
properties_file("/etc/syslog-ng/syslog_producer.properties")
message("$(format-json time=$ISODATE tags host=$HOST message='${MSGHDR}${MSG}')")
);
};
log{ source(s_network_udp); rewrite(test); destination(pfsense_kafka);};
syslog_producer.properties
acks=all
#transactional.id=pfsenseProducer
#transaction.state.log.replication.factor=1
enable.idempotence=true
#retries=10000000
message.send.max.retries=10000000
max.in.flight.requests.per.connection=1
I have read about Idempotence Producer and setting transaction.id will provide exactly once delivery,but nothing work for me
when i enable enable.idempotence=true,message.send.max.retries=10000000,max.in.flight.requests.per.connection=1
I receive the messages sent by syslog-ng but when i enable 'transaction.id' i didn't receive any messages