#!/bin/bash

FORWARDLOGS="${FORWARDLOGS:-1}"
# LOGS=(broker schema-registry rest-proxy connect-distributed zookeeper)
LOGS=(broker)

if [[ "$FORWARDLOGS" == "0" ]]; then
    echo "Skipping sinking logs to kafka  due to \$FORWARDLOGS = 0."
    exit 0
fi

for (( i=0; i<${#LOGS[@]}; i++)); do
cat <<EOF >/tmp/connector
{
  "name": "logs-${LOGS[$i]}",
  "config": {
    "connector.class": "org.apache.kafka.connect.file.FileStreamSourceConnector",
    "tasks.max": "1",
    "topic": "logs-${LOGS[$i]}",
    "file":"/var/log/${LOGS[$i]}.log"
  }
}
EOF

    curl -vs --stderr - -X POST -H "Content-Type: application/json" \
         --data @/tmp/connector "http://localhost:8083/connectors"
done

rm /tmp/connector


#!/bin/bash

FORWARDLOGS="${FORWARDLOGS:-1}"
# LOGS=(broker schema-registry rest-proxy connect-distributed zookeeper)
LOGS=(broker)

if [[ "$FORWARDLOGS" == "0" ]]; then
    echo "Skipping sinking logs to kafka  due to \$FORWARDLOGS = 0."
    exit 0
fi

for (( i=0; i<${#LOGS[@]}; i++)); do
cat <<EOF >/tmp/connector
{
  "name": "logs-${LOGS[$i]}",
  "config": {
    "connector.class": "org.apache.kafka.connect.file.FileStreamSourceConnector",
    "tasks.max": "1",
    "topic": "logs_${LOGS[$i]}",
    "file":"/var/log/${LOGS[$i]}.log"
  }
}
EOF

    curl -vs --stderr - -X POST -H "Content-Type: application/json" \
         --data @/tmp/connector "http://localhost:8083/connectors"
done

rm /tmp/connector


Change default log source connector topic to log_broker from log-broker.
Change default log source connector topic to log_broker from log-broker.

Signed-off-by: Marios Andreopoulos <279a4cf6d7f8da1ddc113bb946b9273d9d938683@andmarios.com>
