aboutsummaryrefslogtreecommitdiffstats
path: root/deployments/helm/v2/emco/fluentd/templates/forwarder-configmap.yaml
blob: 4fe7a7627f6744704855e5880389ea9873c97bbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
{{- if and .Values.forwarder.enabled (not .Values.forwarder.configMap) -}}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "fluentd.fullname" . }}-forwarder-cm
  labels: {{- include "fluentd.labels" . | nindent 4 }}
    app.kubernetes.io/component: forwarder
data:
  fluentd.conf: |
    {{- if .Values.metrics.enabled -}}
    # Prometheus Exporter Plugin
    # input plugin that exports metrics
    <source>
      @type prometheus
      port {{ .Values.metrics.service.port }}
    </source>

    # input plugin that collects metrics from MonitorAgent
    <source>
      @type prometheus_monitor
      <labels>
        host ${hostname}
      </labels>
    </source>

    # input plugin that collects metrics for output plugin
    <source>
      @type prometheus_output_monitor
      <labels>
        host ${hostname}
      </labels>
    </source>

    # input plugin that collects metrics for in_tail plugin
    <source>
      @type prometheus_tail_monitor
      <labels>
        host ${hostname}
      </labels>
    </source>
    {{- end }}

    # Ignore fluentd own events
    <match fluent.**>
      @type null
    </match>

    # HTTP input for the liveness and readiness probes
    <source>
      @type http
      port 9880
    </source>

    # Throw the healthcheck to the standard output instead of forwarding it
    <match fluentd.healthcheck>
      @type stdout
    </match>

    # Get the logs from the containers running in the node
    <source>
      @type tail
      path /var/log/containers/*mco*.log
      # exclude Fluentd logs
      exclude_path /var/log/containers/*fluentd*.log
      pos_file /opt/bitnami/fluentd/logs/buffers/fluentd-docker.pos
      tag kubernetes.*
      read_from_head true
      <parse>
        @type json
      </parse>
    </source>

    # enrich with kubernetes metadata
    <filter kubernetes.**>
      @type kubernetes_metadata
    </filter>
    {{ if .Values.aggregator.enabled }}
    # Forward all logs to the aggregators
    <match **>
      @type forward
      {{- $fullName := (include "fluentd.fullname" .) }}
      {{- $global := . }}
      {{- $domain := default "cluster.local" .Values.clusterDomain }}
      {{- $port := .Values.aggregator.port | int }}
      {{- range $i, $e := until (.Values.aggregator.replicaCount | int) }}
      <server>
        {{ printf "host %s-%d.%s-headless.%s.svc.%s" $fullName $i $fullName $global.Release.Namespace $domain }}
        {{ printf "port %d" $port }}
        {{- if ne $i 0 }}
        standby
        {{- end }}
      </server>
      {{- end}}

      <buffer>
        @type file
        path /opt/bitnami/fluentd/logs/buffers/logs.buffer
        flush_thread_count 2
        flush_interval 5s
      </buffer>
    </match>
    {{- else }}
    # Send the logs to the standard output
    <match **>
      @type stdout
    </match>
    {{- end -}}
{{- end -}}