How to kafkacat
For consuming the Kafka topic from DCC we use Kafkacat. However to consume the Kafka topic we need to be in our VPC and we created an EC2 instance for this purpose. First let's login to the instance:
- Ensure you have the
Kafkacat.pem
(otherwise ask somebody in the MyChannels team) and ensure it has the right permissions (otherwise runchmod 400 Kafkacat.pem
) ssh -i "Kafkacat.pem" ubuntu@ec2-54-171-217-184.eu-west-1.compute.amazonaws.com
If it didn't work it could be because of the security group and you need to add an inbound SSH rule with your IP as source to get access (already added the IP from the office).
Consume Kafka topic
Consume 1 message and pretty print the JSON
kafkacat -C -b 10.224.149.98:9092,10.224.149.24:9092,10.224.148.111:9092 -t profileservice-mychannels-json-events -c1 | jq .
Filter Kafka topic realtime
Filter events realtime with a select
kafkacat -C -b 10.224.149.98:9092,10.224.149.24:9092,10.224.148.111:9092 -t profileservice-mychannels-json-events | jq 'select(.app_id == "mychannels.app.games")'
### Also filter by office IP
kafkacat -C -b 10.224.149.98:9092,10.224.149.24:9092,10.224.148.111:9092 -t profileservice-mychannels-json-events | jq 'select(.app_id == "mychannels.web.video")' | jq 'select(.user_ipaddress == "145.60.8.1")'