[VOL-634] Remove fluentd logging reference from voltha services

This update removes the "hardcoded" logging framework (fluentd)
from the voltha, ofagent and netconf services.  The logging is
now determined at deployment time.  Testing was done in kubernetes
environment and minimally in docker swarm mode environment (docker
swarm mode is not required for voltha 1.3).  A separate Jira will
be raised to adjust the docker swarm deployment files, i.e. direct
the logs to fluentd/fluentd-agg listen ports instead of writing locally.

Change-Id: Ic780fc9633f0f833f961c97dc59d89eed2112a53
diff --git a/compose/docker-compose-all.yml.j2 b/compose/docker-compose-all.yml.j2
index cdf829b..46cccfe 100755
--- a/compose/docker-compose-all.yml.j2
+++ b/compose/docker-compose-all.yml.j2
@@ -130,7 +130,6 @@
       - voltha/voltha/main.py
       - -v
       - --consul=vconsul:8500
-      - --fluentd=fluentd:24224
       - --kafka=kafka
       - --rest-port=8880
       - --grpc-port=50556
@@ -162,7 +161,6 @@
       - /ofagent/ofagent/main.py
       - -v
       - --consul=vconsul:8500
-      - --fluentd=fluentd:24224
       - --controller=onos:6653
       - --grpc-endpoint=vcore:50556
       - --instance-id-is-container-name
@@ -242,7 +240,6 @@
       - /netconf/netconf/main.py
       - -v
       - --consul=vconsul:8500
-      - --fluentd=fluentd:24224
       - --grpc-endpoint=voltha:50555
       - --instance-id-is-container-name
     networks:
diff --git a/compose/docker-compose-docutests.yml b/compose/docker-compose-docutests.yml
index ba6e94b..aa94006 100644
--- a/compose/docker-compose-docutests.yml
+++ b/compose/docker-compose-docutests.yml
@@ -76,11 +76,15 @@
   #
   voltha:
     image: "${REGISTRY}${REPOSITORY}voltha-voltha:latest"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "10m"
+        max-file: "3"
     command: [
       "/voltha/voltha/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--rest-port=8880",
       "--grpc-port=50555",
       "--kafka=@kafka",
@@ -97,7 +101,6 @@
     - vconsul
     links:
     - vconsul
-    - fluentd
     environment:
       SERVICE_8880_NAME: "voltha-health"
       SERVICE_8880_CHECK_HTTP: "/health"
@@ -116,11 +119,15 @@
   #
   ofagent:
     image: "${REGISTRY}${REPOSITORY}voltha-ofagent:latest"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "10m"
+        max-file: "3"
     command: [
       "/ofagent/ofagent/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--controller=${DOCKER_HOST_IP}:6653",
       "--grpc-endpoint=@voltha-grpc",
       "--instance-id-is-container-name",
@@ -131,7 +138,6 @@
     - voltha
     links:
     - vconsul
-    - fluentd
     volumes:
     - "/var/run/docker.sock:/tmp/docker.sock"
     restart: unless-stopped
@@ -141,12 +147,16 @@
   #
   netconf:
     image: "${REGISTRY}${REPOSITORY}voltha-netconf:latest"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "10m"
+        max-file: "3"
     privileged: true
     command: [
       "/netconf/netconf/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--grpc-endpoint=@voltha-grpc",
       "--instance-id-is-container-name",
       "-v"
@@ -158,7 +168,6 @@
     - voltha
     links:
     - vconsul
-    - fluentd
     environment:
       SERVICE_1830_NAME: "netconf-server"
     volumes:
diff --git a/compose/docker-compose-fixed-port.yml b/compose/docker-compose-fixed-port.yml
index c810940..1f9aeb4 100644
--- a/compose/docker-compose-fixed-port.yml
+++ b/compose/docker-compose-fixed-port.yml
@@ -116,7 +116,6 @@
       "/voltha/voltha/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--rest-port=8880",
       "--grpc-port=50555",
       "--kafka=@kafka",
@@ -132,7 +131,6 @@
     - vconsul
     links:
     - vconsul
-    - fluentd
     environment:
       SERVICE_8880_NAME: "voltha-health"
       SERVICE_8880_CHECK_HTTP: "/health"
@@ -159,7 +157,6 @@
       "/ofagent/ofagent/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--controller=${DOCKER_HOST_IP}:6653",
       "--grpc-endpoint=@voltha-grpc",
       "--instance-id-is-container-name",
@@ -170,7 +167,6 @@
     - voltha
     links:
     - vconsul
-    - fluentd
     volumes:
     - "/var/run/docker.sock:/tmp/docker.sock"
     restart: unless-stopped
@@ -185,7 +181,6 @@
       "/netconf/netconf/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--grpc-endpoint=@voltha-grpc",
       "--instance-id-is-container-name",
       "-v"
@@ -197,7 +192,6 @@
     - voltha
     links:
     - vconsul
-    - fluentd
     environment:
       SERVICE_1830_NAME: "netconf-server"
     volumes:
diff --git a/compose/docker-compose-netconf-swarm.yml b/compose/docker-compose-netconf-swarm.yml
index 091ea79..7dcbebf 100644
--- a/compose/docker-compose-netconf-swarm.yml
+++ b/compose/docker-compose-netconf-swarm.yml
@@ -27,7 +27,6 @@
       - /netconf/netconf/main.py
       - -v
       - --consul=vconsul:8500
-      - --fluentd=fluentd:24224
       - --grpc-endpoint=voltha:50555
       - --instance-id-is-container-name
     networks:
diff --git a/compose/docker-compose-ofagent-swarm.yml b/compose/docker-compose-ofagent-swarm.yml
index 8fc5ea2..8e766f5 100644
--- a/compose/docker-compose-ofagent-swarm.yml
+++ b/compose/docker-compose-ofagent-swarm.yml
@@ -21,7 +21,6 @@
             - /ofagent/ofagent/main.py
             - -v
             - --consul=vconsul:8500
-            - --fluentd=fluentd:24224
             - --controller=onos:6653
             - --grpc-endpoint=vcore:50556
             - --instance-id-is-container-name
diff --git a/compose/docker-compose-ofagent-test.yml b/compose/docker-compose-ofagent-test.yml
index 516196f..2f801c2 100644
--- a/compose/docker-compose-ofagent-test.yml
+++ b/compose/docker-compose-ofagent-test.yml
@@ -55,7 +55,6 @@
       "/voltha/voltha/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--rest-port=8880",
       "--grpc-port=50556",
       "--kafka=@kafka",
@@ -73,7 +72,6 @@
     - vconsul
     links:
     - vconsul
-    - fluentd
     environment:
       SERVICE_8880_NAME: "voltha-health"
       SERVICE_8880_CHECK_HTTP: "/health"
@@ -182,13 +180,12 @@
   #
   ofagent:
     image: "${REGISTRY}${REPOSITORY}voltha-ofagent:${TAG:-latest}"
-    command: /ofagent/ofagent/main.py -v --consul=${DOCKER_HOST_IP}:8500 --fluentd=fluentd:24224 --controller ${DOCKER_HOST_IP}:6633 ${DOCKER_HOST_IP}:6644 ${DOCKER_HOST_IP}:6655 --grpc-endpoint=@voltha-grpc --instance-id-is-container-name --enable-tls --key-file=/ofagent/pki/voltha.key --cert-file=/ofagent/pki/voltha.crt
+    command: /ofagent/ofagent/main.py -v --consul=${DOCKER_HOST_IP}:8500 --controller ${DOCKER_HOST_IP}:6633 ${DOCKER_HOST_IP}:6644 ${DOCKER_HOST_IP}:6655 --grpc-endpoint=@voltha-grpc --instance-id-is-container-name --enable-tls --key-file=/ofagent/pki/voltha.key --cert-file=/ofagent/pki/voltha.crt
     depends_on:
     - vconsul
     - voltha
     links:
     - vconsul
-    - fluentd
     volumes:
     - "/var/run/docker.sock:/tmp/docker.sock"
     restart: unless-stopped
diff --git a/compose/docker-compose-system-test-dispatcher.yml b/compose/docker-compose-system-test-dispatcher.yml
index 36ae7d6..530c772 100644
--- a/compose/docker-compose-system-test-dispatcher.yml
+++ b/compose/docker-compose-system-test-dispatcher.yml
@@ -114,11 +114,15 @@
   #
   voltha:
     image: "${REGISTRY}${REPOSITORY}voltha-voltha${TAG}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "10m"
+        max-file: "3"
     command: [
       "/voltha/voltha/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--rest-port=8880",
       "--grpc-port=50556",
       "--kafka=@kafka",
@@ -135,7 +139,6 @@
     - vconsul
     links:
     - vconsul
-    - fluentd
     environment:
       SERVICE_8880_NAME: "voltha-health"
       SERVICE_8880_CHECK_HTTP: "/health"
@@ -202,11 +205,15 @@
   #
   ofagent:
     image: "${REGISTRY}${REPOSITORY}voltha-ofagent${TAG}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "10m"
+        max-file: "3"
     command: [
       "/ofagent/ofagent/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--controller=${DOCKER_HOST_IP}:6653",
       "--grpc-endpoint=@voltha-grpc",
       "--instance-id-is-container-name",
@@ -217,7 +224,6 @@
     - voltha
     links:
     - vconsul
-    - fluentd
     volumes:
     - "/var/run/docker.sock:/tmp/docker.sock"
     restart: unless-stopped
@@ -227,12 +233,16 @@
   #
   netconf:
     image: "${REGISTRY}${REPOSITORY}voltha-netconf${TAG}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "10m"
+        max-file: "3"
     privileged: true
     command: [
       "/netconf/netconf/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--grpc-endpoint=@voltha-grpc",
       "--instance-id-is-container-name",
       "-v"
@@ -244,7 +254,6 @@
     - voltha
     links:
     - vconsul
-    - fluentd
     environment:
       SERVICE_1830_NAME: "netconf-server"
     volumes:
diff --git a/compose/docker-compose-system-test-encrypted.yml b/compose/docker-compose-system-test-encrypted.yml
index 9c0f9d1..d5c466e 100644
--- a/compose/docker-compose-system-test-encrypted.yml
+++ b/compose/docker-compose-system-test-encrypted.yml
@@ -117,11 +117,15 @@
   #
   voltha:
     image: "${REGISTRY}${REPOSITORY}voltha-voltha${TAG}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "10m"
+        max-file: "3"
     command: [
       "/voltha/voltha/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--rest-port=8880",
       "--grpc-port=50555",
       "--kafka=@kafka",
@@ -137,7 +141,6 @@
     - vconsul
     links:
     - vconsul
-    - fluentd
     environment:
       SERVICE_8880_NAME: "voltha-health"
       SERVICE_8880_CHECK_HTTP: "/health"
@@ -176,11 +179,15 @@
   #
   ofagent:
     image: "${REGISTRY}${REPOSITORY}voltha-ofagent${TAG}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "10m"
+        max-file: "3"
     command: [
       "/ofagent/ofagent/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--controller=${DOCKER_HOST_IP}:6653",
       "--grpc-endpoint=@voltha-grpc",
       "--instance-id-is-container-name",
@@ -191,7 +198,6 @@
     - voltha
     links:
     - vconsul
-    - fluentd
     volumes:
     - "/var/run/docker.sock:/tmp/docker.sock"
     restart: unless-stopped
@@ -201,12 +207,16 @@
   #
   netconf:
     image: "${REGISTRY}${REPOSITORY}voltha-netconf${TAG}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "10m"
+        max-file: "3"
     privileged: true
     command: [
       "/netconf/netconf/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--grpc-endpoint=@voltha-grpc",
       "--instance-id-is-container-name",
       "-v"
@@ -218,7 +228,6 @@
     - voltha
     links:
     - vconsul
-    - fluentd
     environment:
       SERVICE_1830_NAME: "netconf-server"
     volumes:
diff --git a/compose/docker-compose-system-test-persistence.yml b/compose/docker-compose-system-test-persistence.yml
index 99f42eb..57d0006 100644
--- a/compose/docker-compose-system-test-persistence.yml
+++ b/compose/docker-compose-system-test-persistence.yml
@@ -114,11 +114,15 @@
   #
   voltha:
     image: "${REGISTRY}${REPOSITORY}voltha-voltha${TAG}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "10m"
+        max-file: "3"
     command: [
       "/voltha/voltha/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--rest-port=8880",
       "--grpc-port=50556",
       "--kafka=@kafka",
@@ -135,7 +139,6 @@
     - vconsul
     links:
     - vconsul
-    - fluentd
     environment:
       SERVICE_8880_NAME: "voltha-health"
       SERVICE_8880_CHECK_HTTP: "/health"
@@ -202,11 +205,15 @@
   #
   ofagent:
     image: "${REGISTRY}${REPOSITORY}voltha-ofagent${TAG}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "10m"
+        max-file: "3"
     command: [
       "/ofagent/ofagent/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--controller=${DOCKER_HOST_IP}:6653",
       "--grpc-endpoint=@voltha-grpc",
       "--instance-id-is-container-name",
@@ -217,7 +224,6 @@
     - voltha
     links:
     - vconsul
-    - fluentd
     volumes:
     - "/var/run/docker.sock:/tmp/docker.sock"
     restart: unless-stopped
@@ -227,12 +233,16 @@
   #
   netconf:
     image: "${REGISTRY}${REPOSITORY}voltha-netconf${TAG}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "10m"
+        max-file: "3"
     privileged: true
     command: [
       "/netconf/netconf/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--grpc-endpoint=@voltha-grpc",
       "--instance-id-is-container-name",
       "-v"
@@ -244,7 +254,6 @@
     - voltha
     links:
     - vconsul
-    - fluentd
     environment:
       SERVICE_1830_NAME: "netconf-server"
     volumes:
diff --git a/compose/docker-compose-system-test-with-etcd.yml b/compose/docker-compose-system-test-with-etcd.yml
index 8dd257f..37f8237 100644
--- a/compose/docker-compose-system-test-with-etcd.yml
+++ b/compose/docker-compose-system-test-with-etcd.yml
@@ -134,12 +134,16 @@
   #
   voltha:
     image: "${REGISTRY}${REPOSITORY}voltha-voltha${TAG}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "10m"
+        max-file: "3"
     command: [
       "/voltha/voltha/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
       "--etcd=${DOCKER_HOST_IP}:2379",
-      "--fluentd=fluentd:24224",
       "--rest-port=8880",
       "--grpc-port=50556",
       "--kafka=@kafka",
@@ -159,7 +163,6 @@
     links:
     - vconsul
     - etcd
-    - fluentd
     environment:
       SERVICE_8880_NAME: "voltha-health"
       SERVICE_8880_CHECK_HTTP: "/health"
@@ -229,11 +232,15 @@
   #
   ofagent:
     image: "${REGISTRY}${REPOSITORY}voltha-ofagent${TAG}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "10m"
+        max-file: "3"
     command: [
       "/ofagent/ofagent/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--controller=${DOCKER_HOST_IP}:6653",
       "--grpc-endpoint=@voltha-grpc",
       "--instance-id-is-container-name",
@@ -247,7 +254,6 @@
     - voltha
     links:
     - vconsul
-    - fluentd
     volumes:
     - "/var/run/docker.sock:/tmp/docker.sock"
     restart: unless-stopped
@@ -257,12 +263,16 @@
   #
   netconf:
     image: "${REGISTRY}${REPOSITORY}voltha-netconf${TAG}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "10m"
+        max-file: "3"
     privileged: true
     command: [
       "/netconf/netconf/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--grpc-endpoint=@voltha-grpc",
       "--instance-id-is-container-name",
       "-v"
@@ -274,7 +284,6 @@
     - voltha
     links:
     - vconsul
-    - fluentd
     environment:
       SERVICE_1830_NAME: "netconf-server"
     volumes:
diff --git a/compose/docker-compose-system-test.yml b/compose/docker-compose-system-test.yml
index 52e3cf7..0ca70fd 100644
--- a/compose/docker-compose-system-test.yml
+++ b/compose/docker-compose-system-test.yml
@@ -114,11 +114,19 @@
   #
   voltha:
     image: "${REGISTRY}${REPOSITORY}voltha-voltha${TAG}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "10m"
+        max-file: "3"
+#      Use the fluentd driver to push logs to fluentd instead
+#      driver: "fluentd"
+#      options:
+#        fluentd-address: ${DOCKER_HOST_IP}:24224
     command: [
       "/voltha/voltha/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--rest-port=8880",
       "--grpc-port=50556",
       "--kafka=@kafka",
@@ -136,7 +144,6 @@
     - vconsul
     links:
     - vconsul
-    - fluentd
     environment:
       SERVICE_8880_NAME: "voltha-health"
       SERVICE_8880_CHECK_HTTP: "/health"
@@ -203,11 +210,19 @@
   #
   ofagent:
     image: "${REGISTRY}${REPOSITORY}voltha-ofagent${TAG}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "10m"
+        max-file: "3"
+#      Use the fluentd driver to push logs to fluentd instead
+#      driver: "fluentd"
+#      options:
+#        fluentd-address: ${DOCKER_HOST_IP}:24224
     command: [
       "/ofagent/ofagent/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--controller=${DOCKER_HOST_IP}:6653",
       "--grpc-endpoint=@voltha-grpc",
       "--instance-id-is-container-name",
@@ -221,7 +236,6 @@
     - voltha
     links:
     - vconsul
-    - fluentd
     volumes:
     - "/var/run/docker.sock:/tmp/docker.sock"
     restart: unless-stopped
@@ -231,12 +245,20 @@
   #
   netconf:
     image: "${REGISTRY}${REPOSITORY}voltha-netconf${TAG}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "10m"
+        max-file: "3"
+#      Use the fluentd driver to push logs to fluentd instead
+#      driver: "fluentd"
+#      options:
+#        fluentd-address: ${DOCKER_HOST_IP}:24224
     privileged: true
     command: [
       "/netconf/netconf/main.py",
       "-v",
       "--consul=${DOCKER_HOST_IP}:8500",
-      "--fluentd=fluentd:24224",
       "--grpc-endpoint=@voltha-grpc",
       "--instance-id-is-container-name",
       "-v"
@@ -248,7 +270,6 @@
     - voltha
     links:
     - vconsul
-    - fluentd
     environment:
       SERVICE_1830_NAME: "netconf-server"
     volumes:
diff --git a/compose/docker-compose-voltha-swarm.yml b/compose/docker-compose-voltha-swarm.yml
index 00c5b73..3e30236 100644
--- a/compose/docker-compose-voltha-swarm.yml
+++ b/compose/docker-compose-voltha-swarm.yml
@@ -13,7 +13,6 @@
       - voltha/voltha/main.py
       - -v
       - --consul=vconsul:8500
-      - --fluentd=fluentd:24224
       - --kafka=kafka
       - --rest-port=8880
       - --grpc-port=50556
diff --git a/compose/voltha-stack.yml.j2 b/compose/voltha-stack.yml.j2
index 728ad5a..8afa37d 100644
--- a/compose/voltha-stack.yml.j2
+++ b/compose/voltha-stack.yml.j2
@@ -339,7 +339,6 @@
       - voltha/voltha/main.py
       - -v
       - --consul=vconsul:8500
-      - --fluentd=fluentd:24224
       - --kafka=kafka
       - --rest-port=8880
       - --grpc-port=50556
@@ -371,7 +370,6 @@
       - /ofagent/ofagent/main.py
       - -v
       - --consul=vconsul:8500
-      - --fluentd=fluentd:24224
       - --controller=onos:6653
       - --grpc-endpoint=vcore:50556
       - --instance-id-is-container-name
@@ -458,7 +456,6 @@
       - /netconf/netconf/main.py
       - -v
       - --consul=vconsul:8500
-      - --fluentd=fluentd:24224
       - --grpc-endpoint=voltha:50555
       - --instance-id-is-container-name
     networks: