kafka pipe working!!!!!!!!!!!!!!!!!

lots of experiments too - to be deleted
This commit is contained in:
Adam 2021-10-23 22:44:20 +02:00
parent 1c9f415d01
commit 26626263d3
13 changed files with 506 additions and 7 deletions

View file

@ -0,0 +1,21 @@
#!/usr/bin/bash
# Pipe Docker logs from a Factorio server to a Kafka topic
echo "Piping logs from $FACTORIO_SERVER_CONTAINER_NAME to $KAFKA_HOST"
trap endProcess SIGINT
endProcess() {
echo "Exiting Factorio Events Kafka Pipe"
exit
}
while :; do
docker logs --tail 0 -f "$FACTORIO_SERVER_CONTAINER_NAME" |
sed -n -e 's/^FactorioEvent: //p' |
kafkacat -P -b "$KAFKA_HOST" -t factorio-server-log
echo "Error - retrying in 10 seconds"
sleep 10
done