application_config.yaml: |
 {{ $appConf | toYaml | indent 4 }}
 
-{{- if .Values.logDirectory }}
----
-apiVersion: v1
-kind: ConfigMap
-metadata:
-  name: {{ include "common.fullname" . }}-filebeat-configmap
-  namespace: {{ include "common.namespace" . }}
-  labels: {{ include "common.labels" . | nindent 6 }}
-data:
-  filebeat.yml: |-
-{{ include "dcaegen2-services-common.filebeatConfiguration" . | indent 4 }}
-{{- end }}
-
 {{- if .Values.drFeedConfig }}
 ---
 apiVersion: v1
   {{ $topics | toJson | indent 2 }}
   {{- end }}
 {{- end }}
-{{- end }}
\ No newline at end of file
+{{- end }}
 
 */}}
 
 {{- define "dcaegen2-services-common.microserviceDeployment" -}}
-{{- $logDir :=  default "" .Values.logDirectory -}}
+{{- $logDir :=  default "" .Values.log.path -}}
 {{- $certDir := default "" .Values.certDirectory . -}}
 {{- $tlsServer := default "" .Values.tlsServer -}}
 {{- $commonRelease :=  print (include "common.release" .) -}}
           name: app-config-input
         {{- if $logDir }}
         - mountPath: {{ $logDir}}
-          name: component-log
+          name: logs
         {{- end }}
         {{- if $certDir }}
         - mountPath: {{ $certDir }}
         {{- end }}
         {{- include "dcaegen2-services-common._externalVolumeMounts" . | nindent 8 }}
       {{- if $logDir }}
-      - image: {{ include "repositoryGenerator.image.logging" . }}
-        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-        name: filebeat
-        env:
-        - name: POD_IP
-          valueFrom:
-            fieldRef:
-              apiVersion: v1
-              fieldPath: status.podIP
-        resources: {{ include "common.resources" . | nindent 2 }}
-        volumeMounts:
-        - mountPath: /var/log/onap/{{ include "common.name" . }}
-          name: component-log
-        - mountPath: /usr/share/filebeat/data
-          name: filebeat-data
-        - mountPath: /usr/share/filebeat/filebeat.yml
-          name: filebeat-conf
-          subPath: filebeat.yml
+      {{ include "common.log.sidecar" . | nindent 6 }}
       {{- end }}
       {{- if $policy }}
       - image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.dcaePolicySyncImage }}
         name: app-config
       {{- if $logDir }}
       - emptyDir: {}
-        name: component-log
-      - emptyDir: {}
-        name: filebeat-data
-      - configMap:
-          defaultMode: 420
-          name: {{ include "common.fullname" . }}-filebeat-configmap
-        name: filebeat-conf
+        name: logs
+      {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix . )) | nindent 6 }}
       {{- end }}
       {{- if $certDir }}
       - emptyDir: {}
 
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
+  centralizedLoggingEnabled: true
 
 #################################################################
 # Filebeat Configuration Defaults.
 pullPolicy: Always
 
 # Log directory where logging sidecar should look for log files
-# if absent, no sidecar will be deployed
-logDirectory: /opt/app/bbs-event-processor/logs
+# if path is set to null sidecar won't be deployed in spite of
+# global.centralizedLoggingEnabled setting.
+log:
+  path: /opt/app/bbs-event-processor/logs
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
 
 # Directory where TLS certs should be stored
 # if absent, no certs will be retrieved and stored
 
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
+  centralizedLoggingEnabled: true
 
 #################################################################
 # Filebeat Configuration Defaults.
 pullPolicy: Always
 
 # Log directory where logging sidecar should look for log files
-# if absent, no sidecar will be deployed
-logDirectory: /var/log/ONAP
+# if path is set to null sidecar won't be deployed in spite of
+# global.centralizedLoggingEnabled setting.
+log:
+  path: /var/log/ONAP
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
 
 # Directory where TLS certs should be stored
 # if absent, no certs will be retrieved and stored
 
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
+  centralizedLoggingEnabled: true
 
 #################################################################
 # Filebeat Configuration Defaults.
 image: onap/org.onap.dcaegen2.services.datalakeadminui:1.1.1
 
 # Log directory where logging sidecar should look for log files
-# if absent, no sidecar will be deployed
-logDirectory: /var/log/ONAP/dcaegen2/services/datalake-admin-ui
+# if path is set to null sidecar won't be deployed in spite of
+# global.centralizedLoggingEnabled setting.
+log:
+  path: /var/log/ONAP/dcaegen2/services/datalake-admin-ui
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
 
 # Directory where TLS certs should be stored
 # if absent, no certs will be retrieved and stored
 
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
+  centralizedLoggingEnabled: true
 
 #################################################################
 # Filebeat Configuration Defaults.
-#B
+#
 #################################################################
 filebeatConfig:
   logstashServiceName: log-ls
 image: onap/org.onap.dcaegen2.services.datalake.exposure.service:1.1.1
 
 # Log directory where logging sidecar should look for log files
-# if absent, no sidecar will be deployed
-logDirectory: /var/log/ONAP/dcaegen2/services/datalake
+# if path is set to null sidecar won't be deployed in spite of
+# global.centralizedLoggingEnabled setting.
+log:
+  path: /var/log/ONAP/dcaegen2/services/datalake
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
 
 # Directory where TLS certs should be stored
 # if absent, no certs will be retrieved and stored
 
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
+  centralizedLoggingEnabled: true
 
 #################################################################
 # Filebeat Configuration Defaults.
 pullPolicy: Always
 
 # Log directory where logging sidecar should look for log files
-# if absent, no sidecar will be deployed
-logDirectory: /var/log/ONAP/dcaegen2/services/datalake
+# if path is set to null sidecar won't be deployed in spite of
+# global.centralizedLoggingEnabled setting.
+log:
+  path: /var/log/ONAP/dcaegen2/services/datalake
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
 
 # Directory where TLS certs should be stored
 # if absent, no certs will be retrieved and stored
 
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
+  centralizedLoggingEnabled: true
 
 #################################################################
 # Filebeat Configuration Defaults.
 pullPolicy: Always
 
 # Log directory where logging sidecar should look for log files
-# if absent, no sidecar will be deployed
-logDirectory: /var/log/ONAP/dcaegen2/services/heartbeat
+# if path is set to null sidecar won't be deployed in spite of
+# global.centralizedLoggingEnabled setting.
+log:
+  path: /var/log/ONAP/dcaegen2/services/heartbeat
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
 
 # Directory where TLS certs should be stored
 # if absent, no certs will be retrieved and stored
 
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
+  centralizedLoggingEnabled: true
 
 #################################################################
 # Filebeat configuration defaults.
 pullPolicy: Always
 
 # log directory where logging sidecar should look for log files
-# if absent, no sidecar will be deployed
-logDirectory: /var/log/ONAP/dcae-hv-ves-collector
+# if path is set to null sidecar won't be deployed in spite of
+# global.centralizedLoggingEnabled setting.
+log:
+  path: /var/log/ONAP/dcae-hv-ves-collector
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
 
 # directory where TLS certs should be stored
 # if absent, no certs will be retrieved and stored
 
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
+  centralizedLoggingEnabled: true
 
 #################################################################
 # Filebeat Configuration Defaults.
 pullPolicy: Always
 
 # Log directory where logging sidecar should look for log files
-# if absent, no sidecar will be deployed
-logDirectory: /var/log/ONAP/dcaegen2/services/kpims
+# if path is set to null sidecar won't be deployed in spite of
+# global.centralizedLoggingEnabled setting.
+log:
+  path: /var/log/ONAP/dcaegen2/services/kpims
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
 
 # Directory where TLS certs should be stored
 # if absent, no certs will be retrieved and stored
 
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
+  centralizedLoggingEnabled: true
 
 #################################################################
 # Filebeat Configuration Defaults.
 pullPolicy: Always
 
 # Log directory where logging sidecar should look for log files
-# if absent, no sidecar will be deployed
-logDirectory: /var/log/ONAP/dcaegen2/services/pm-mapper
+# if path is set to null sidecar won't be deployed in spite of
+# global.centralizedLoggingEnabled setting.
+log:
+  path: /var/log/ONAP/dcaegen2/services/pm-mapper
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
 
 # Directory where TLS certs should be stored
 # if absent, no certs will be retrieved and stored
 
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
+  centralizedLoggingEnabled: true
 
 #################################################################
 # Filebeat Configuration Defaults.
 pullPolicy: Always
 
 # Log directory where logging sidecar should look for log files
-# if absent, no sidecar will be deployed
-logDirectory: /var/log/ONAP/dcaegen2/services/pmsh
+# if path is set to null sidecar won't be deployed in spite of
+# global.centralizedLoggingEnabled setting.
+log:
+  path: /var/log/ONAP/dcaegen2/services/pmsh
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
 
 # Directory where TLS certs should be stored
 # if absent, no certs will be retrieved and stored
 
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
+  centralizedLoggingEnabled: true
 
 #################################################################
 # Filebeat configuration defaults.
 pullPolicy: Always
 
 # log directory where logging sidecar should look for log files
-# if absent, no sidecar will be deployed
-logDirectory: /opt/app/prh/logs
+# if path is set to null sidecar won't be deployed in spite of
+# global.centralizedLoggingEnabled setting.
+log:
+  path: /opt/app/prh/logs
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
 
 # directory where TLS certs should be stored
 # if absent, no certs will be retrieved and stored
 
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
+  centralizedLoggingEnabled: false
 
 #################################################################
 # Filebeat Configuration Defaults.
 pullPolicy: Always
 
 # Log directory where logging sidecar should look for log files
-# if absent, no sidecar will be deployed
-# logDirectory: /opt/app/restconfcollector/logs
+# if path is set to null sidecar won't be deployed in spite of
+# global.centralizedLoggingEnabled setting.
+log:
+  path: null # /opt/app/restconfcollector/logs
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
 
 # Directory where TLS certs should be stored
 # if absent, no certs will be retrieved and stored
 
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
+  centralizedLoggingEnabled: true
 
 #################################################################
 # Filebeat Configuration Defaults.
 image: onap/org.onap.dcaegen2.services.components.slice-analysis-ms:1.0.6
 
 # Log directory where logging sidecar should look for log files
-# if absent, no sidecar will be deployed
-logDirectory: /var/log/ONAP/dcaegen2/services/sliceanalysisms
+# if path is set to null sidecar won't be deployed in spite of
+# global.centralizedLoggingEnabled setting.
+log:
+  path: /var/log/ONAP/dcaegen2/services/sliceanalysisms
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
 
 # Directory where TLS certs should be stored
 # if absent, no certs will be retrieved and stored
 
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
+  centralizedLoggingEnabled: true
 
 #################################################################
 # Filebeat Configuration Defaults.
 pullPolicy: Always
 
 # Log directory where logging sidecar should look for log files
-# if absent, no sidecar will be deployed
-logDirectory: /opt/app/snmptrap/logs
+# if path is set to null sidecar won't be deployed in spite of
+# global.centralizedLoggingEnabled setting.
+log:
+  path: /opt/app/snmptrap/logs
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
 
 
 # TLS role -- set to true if microservice acts as server
 
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
+  centralizedLoggingEnabled: true
 
 #################################################################
 # Filebeat Configuration Defaults.
 pullPolicy: Always
 
 # Log directory where logging sidecar should look for log files
-# if absent, no sidecar will be deployed
-logDirectory: /var/log/ONAP/dcaegen2/services/sonhms
+# if path is set to null sidecar won't be deployed in spite of
+# global.centralizedLoggingEnabled setting.
+log:
+  path: /var/log/ONAP/dcaegen2/services/sonhms
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
 
 # Directory where TLS certs should be stored
 # if absent, no certs will be retrieved and stored
 
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
+  centralizedLoggingEnabled: true
 
 #################################################################
 # Filebeat configuration defaults.
 pullPolicy: Always
 
 # log directory where logging sidecar should look for log files
-# if absent, no sidecar will be deployed
-logDirectory: /opt/logs/dcae-analytics-tca
+# if path is set to null sidecar won't be deployed in spite of
+# global.centralizedLoggingEnabled setting.
+log:
+  path: /opt/logs/dcae-analytics-tca
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
 
 # directory where TLS certs should be stored
 # if absent, no certs will be retrieved and stored
 
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
+  centralizedLoggingEnabled: true
 
 #################################################################
 # Filebeat configuration defaults.
 pullPolicy: Always
 
 # log directory where logging sidecar should look for log files
-# if absent, no sidecar will be deployed
-logDirectory: /opt/app/VESCollector/logs
+# if path is set to null sidecar won't be deployed in spite of
+# global.centralizedLoggingEnabled setting.
+log:
+  path: /opt/app/VESCollector/logs
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
 
 # directory where TLS certs should be stored
 # if absent, no certs will be retrieved and stored
 
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
+  centralizedLoggingEnabled: true
 
 #################################################################
 # Filebeat Configuration Defaults.
 pullPolicy: Always
 
 # Log directory where logging sidecar should look for log files
-# if absent, no sidecar will be deployed
-logDirectory: /opt/app/VESAdapter/logs
+# if path is set to null sidecar won't be deployed in spite of
+# global.centralizedLoggingEnabled setting.
+log:
+  path: /opt/app/VESAdapter/logs
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
 
 # Directory where TLS certs should be stored
 # if absent, no certs will be retrieved and stored
 
 
 See dcaegen2-services-common.configMap for more information.
 */}}
-{{- define "dcaegen2-services-common.filebeatConfiguration" -}}
 filebeat.prospectors:
 #it is mandatory, in our case it's log
 - input_type: log
     path: /usr/share/filebeat/logs
     name: mybeat.log
     keepfiles: 7
-{{- end -}}
\ No newline at end of file
 
   name: {{ include "common.release" . }}-dcae-external-repo-configmap-sa88-rel16
   namespace: {{ include "common.namespace" . }}
 data:
-{{ (.Files.Glob "resources/external/schemas/sa88-rel16/*").AsConfig | indent 2 }}
\ No newline at end of file
+{{ (.Files.Glob "resources/external/schemas/sa88-rel16/*").AsConfig | indent 2 }}
+---
+{{ include "common.log.configMap" . }}
 
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+global:
+  centralizedLoggingEnabled: true
+
+#################################################################
+# Filebeat Configuration Defaults.
+#
+#################################################################
+filebeatConfig:
+  logstashServiceName: log-ls
+  logstashPort: 5044
+
 # Control deployment of DCAE microservices at ONAP installation time
 
 dcae-bbs-eventprocessor-ms:
   enabled: false
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
 dcae-datafile-collector:
   enabled: false
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
 dcae-datalake-admin-ui:
   enabled: false
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
 dcae-datalake-des:
   enabled: false
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
 dcae-datalake-feeder:
   enabled: false
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
 dcae-heartbeat:
   enabled: false
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
 dcae-hv-ves-collector:
   enabled: true
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
 dcae-kpi-ms:
   enabled: false
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
 dcae-ms-healthcheck:
   enabled: true
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
 dcae-pm-mapper:
   enabled: false
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
 dcae-pmsh:
   enabled: false
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
 dcae-prh:
   enabled: true
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
 dcae-restconf-collector:
   enabled: false
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
 dcae-slice-analysis-ms:
   enabled: false
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
 dcae-snmptrap-collector:
   enabled: false
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
 dcae-son-handler:
   enabled: false
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
 dcae-tcagen2:
   enabled: true
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
 dcae-ves-collector:
   enabled: true
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
 dcae-ves-mapper:
   enabled: false
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'