Отправка логов в kafka

Works with python2 only

https://github.com/dgadiraju/gen_logs

$ cd ~/tmp
$ git clone https://github.com/dgadiraju/gen_logs

$ sudo mv gen_logs /opt/gen_logs


$ sudo ln -s /opt/gen_logs/start_logs.sh /usr/bin/.
$ sudo ln -s /opt/gen_logs/stop_logs.sh /usr/bin/.
$ sudo ln -s /opt/gen_logs/tail_logs.sh /usr/bin/.


$ start_logs.sh
$ stop_logs.sh
$ tail_logs.sh


// Create topic
$ kafka-topics.sh \
--zookeeper zookeeper1:2181,zookeeper2:2181,zookeeper3:2181/kafka \
--create \
--topic retail \
--partitions 3 \
--replication-factor 1


// List topic
$ kafka-topics.sh \
--list \
--zookeeper zookeeper1:2181,zookeeper2:2181,zookeeper3:2181/kafka


Run

$ start_logs.sh


// Publish Messages
$ tail_logs.sh | kafka-console-producer.sh \
--broker-list kafka1:9092,kafka2:9092,kafka3:9092 \
--topic retail



// Receive Messages
$ kafka-console-consumer.sh \
--bootstrap-server kafka1:9092,kafka2:9092,kafka3:9092 \
--topic retail


$ stop_logs.sh