Commit c2e16b17 authored by Yakubov, Sergey's avatar Yakubov, Sergey
Browse files

add fluentd log service

parent 150e8f89
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.3.0
version: 0.4.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.2.0"
appVersion: "0.4.0"
+54 −0
Original line number Diff line number Diff line
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "rdb.fullname" . }}-fluentd
  labels:
    {{- include "rdb.labels" . | nindent 4 }}
data:
  fluent.conf: |-
    <source>
      @type tail
      path {{ .Values.rdb.log.fileFolder }}/rdb.log*
      pos_file {{ .Values.rdb.log.fileFolder }}/rdb.pos
      tag rdb
      multiline_flush_interval 5s
    <parse>
       @type json
       time_type string
       time_format %Y-%m-%d %H:%M:%S.%L
    </parse>
    </source>
    
    <filter rdb>
      @type record_transformer
      enable_ruby
      <record>
        hostname onyx
        service {{ include "rdb.fullname" . }}
        log_level ${record["level"].downcase}
        remove_keys   level
      </record>
    </filter>
    
    <match rdb>
      @type elasticsearch
      logstash_format true
      host {{ .Values.elastic.host }}
      path {{ .Values.elastic.path }}
      port {{ .Values.elastic.port }}
      scheme https
      ssl_verify false
      user {{ .Values.elastic.user }}
      password {{ .Values.elastic.password }}
      index_name ndip
      <buffer>
          @type memory
          total_limit_size 10MB
          flush_mode interval
          flush_interval 3s
          flush_thread_count 3
          chunk_limit_size 500KB
          overflow_action drop_oldest_chunk
      </buffer>  
    </match>
   
+33 −2
Original line number Diff line number Diff line
@@ -8,15 +8,25 @@ spec:
  selector:
    matchLabels:
      {{- include "rdb.selectorLabels" . | nindent 6 }}
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
      {{- with .Values.podAnnotations }}
        {{- toYaml . | nindent 8 }}
      {{- end }}
        checksum/configf: {{ include (print $.Template.BasePath "/config_fluentd.yaml") . | sha256sum }}
      labels:
        {{- include "rdb.selectorLabels" . | nindent 8 }}
    spec:
      volumes:
        - name: {{ include "rdb.fullname" . }}-fluentd
          configMap:
            name: {{ include "rdb.fullname" . }}-fluentd
        - name: {{ include "rdb.fullname" . }}-logs
          persistentVolumeClaim:
            claimName: {{ include "rdb.fullname" . }}-logs
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
@@ -36,6 +46,27 @@ spec:
              value: "{{ join "," .Values.rdb.auth.userList }}"
            - name: NDIP_AUTH_JWKSURL
              value: "{{ .Values.rdb.auth.jwksUrl }}"
            - name: NDIP_LOGLEVEL
              value: "{{ .Values.rdb.logLevel }}"
            - name: NDIP_LOGSETTINGS_LEVEL
              value: "{{ .Values.rdb.log.level }}"
            - name: NDIP_LOGSETTINGS_LOGTOFILE
              value: "true"
            - name: NDIP_LOGSETTINGS_FILEFOLDER
              value: "{{ .Values.rdb.log.fileFolder }}"
            - name: NDIP_LOGSETTINGS_MAXSIZE
              value: "{{ .Values.rdb.log.maxSizeInGb }}"
            - name: NDIP_LOGSETTINGS_MAXBACKUPS
              value: "{{ .Values.rdb.log.maxBackups }}"
          volumeMounts:
            - mountPath: {{ .Values.rdb.log.fileFolder }}
              name: {{ include "rdb.fullname" . }}-logs
        - name: {{ .Chart.Name }}-sidecar-fluentd
          image: "{{ .Values.fluentd.image.repository }}:{{ .Values.fluentd.image.tag | default "latest" }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          volumeMounts:
            - mountPath: "/fluentd/etc/fluent.conf"
              name: {{ include "rdb.fullname" . }}-fluentd
              subPath: fluent.conf
            - mountPath: {{ .Values.rdb.log.fileFolder }}
              name: {{ include "rdb.fullname" . }}-logs

+10 −0
Original line number Diff line number Diff line
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: {{ include "rdb.fullname" . }}-logs
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 20Mi
 No newline at end of file
+18 −2
Original line number Diff line number Diff line
image:
  repository:  code.ornl.gov:4567/ndip/remote-data-brokers/remote-data-broker
  pullPolicy: Always
  tag: "0.1.0"
  tag: "0.4.0"

podAnnotations: {}

@@ -13,6 +13,22 @@ rdb:
  rabbitMqUrl: localhost:5672
  rabbitMqPassword: guest
  rabbitQueue: test
  logLevel: debug
  log:
    level: debug
    fileFolder: /var/logs/rdb
    maxSizeInGb: 5
    maxBackups: 3


fluentd:
  image:
    repository:  code.ornl.gov:4567/ndip/public-docker/fluentd
    pullPolicy: Always
    tag: "1.16.3"

elastic:
  host: calvera-test.ornl.gov
  path: /elastic
  port: 443
  user: xxx
  password: xxx