From 91e84f25699f7c9c40348453585c7f93c4c19ae4 Mon Sep 17 00:00:00 2001 From: Naseem Date: Fri, 11 Jan 2019 18:36:47 -0500 Subject: [PATCH] [stable/fluent-bit] Add collection of node logs via systemd input (#10303) * Add bool value to enable collection of kubelet logs Signed-off-by: Naseem Ullah * Make systemd input configurable in order to collect node logs Signed-off-by: Naseem Ullah * Collect kubelet, dockerd and node-problem-detector logs by default Signed-off-by: Naseem Ullah * Bump chart minor version Signed-off-by: Naseem Ullah * Disabling node logging by default Signed-off-by: Naseem Ullah --- stable/fluent-bit/Chart.yaml | 2 +- stable/fluent-bit/README.md | 5 +++++ stable/fluent-bit/templates/config.yaml | 10 ++++++++++ stable/fluent-bit/templates/daemonset.yaml | 11 +++++++++++ stable/fluent-bit/values.yaml | 11 ++++++++++- 5 files changed, 37 insertions(+), 2 deletions(-) diff --git a/stable/fluent-bit/Chart.yaml b/stable/fluent-bit/Chart.yaml index b352106f5a..c21890cf76 100755 --- a/stable/fluent-bit/Chart.yaml +++ b/stable/fluent-bit/Chart.yaml @@ -1,5 +1,5 @@ name: fluent-bit -version: 1.2.2 +version: 1.3.0 appVersion: 1.0.1 description: Fast and Lightweight Log/Data Forwarder for Linux, BSD and OSX keywords: diff --git a/stable/fluent-bit/README.md b/stable/fluent-bit/README.md index 44ece00fc8..bbf0dc773a 100644 --- a/stable/fluent-bit/README.md +++ b/stable/fluent-bit/README.md @@ -99,6 +99,11 @@ The following table lists the configurable parameters of the Fluent-Bit chart an | `image.pullSecrets` | Specify image pull secrets | `nil` | | `input.tail.memBufLimit` | Specify Mem_Buf_Limit in tail input | `5MB` | | `input.tail.path` | Specify log file(s) through the use of common wildcards. | `/var/log/containers/*.log` | +| `input.systemd.enabled` | [Enable systemd input](https://fluentbit.io/documentation/current/input/systemd.html) | `false` | +| `input.systemd.filters.systemdUnit | Please see https://fluentbit.io/documentation/current/input/systemd.html | `[docker.service, kubelet.service`, `node-problem-detector.service]` | +| `input.systemd.maxEntries` | Please see https://fluentbit.io/documentation/current/input/systemd.html | `1000` | +| `input.systemd.readFromTail` | Please see https://fluentbit.io/documentation/current/input/systemd.html | `true`| +| `input.systemd.tag` | Please see https://fluentbit.io/documentation/current/input/systemd.html | `host.*`| | `rbac.create` | Specifies whether RBAC resources should be created. | `true` | | `serviceAccount.create` | Specifies whether a ServiceAccount should be created. | `true` | | `serviceAccount.name` | The name of the ServiceAccount to use. | `NULL` | diff --git a/stable/fluent-bit/templates/config.yaml b/stable/fluent-bit/templates/config.yaml index 165a6826bf..64ca48b177 100644 --- a/stable/fluent-bit/templates/config.yaml +++ b/stable/fluent-bit/templates/config.yaml @@ -37,6 +37,16 @@ data: DB /tail-db/tail-containers-state.db DB.Sync Normal {{- end }} +{{- if .Values.input.systemd.enabled }} + [INPUT] + Name systemd + Tag {{ .Values.input.systemd.tag }} +{{- range $value := .Values.input.systemd.filters.systemdUnit }} + Systemd_Filter _SYSTEMD_UNIT="{{ $value }}" +{{- end }} + Max_Entries {{ .Values.input.systemd.maxEntries }} + Read_From_Tail {{ .Values.input.systemd.readFromTail }} +{{- end }} {{ .Values.extraEntries.input | indent 8 }} fluent-bit-filter.conf: |- diff --git a/stable/fluent-bit/templates/daemonset.yaml b/stable/fluent-bit/templates/daemonset.yaml index 4e0896362e..b6785f4f6a 100644 --- a/stable/fluent-bit/templates/daemonset.yaml +++ b/stable/fluent-bit/templates/daemonset.yaml @@ -53,6 +53,11 @@ spec: - name: varlibdockercontainers mountPath: /var/lib/docker/containers readOnly: true + {{- if .Values.input.systemd.enabled }} + - name: etcmachineid + mountPath: /etc/machine-id + readOnly: true + {{- end }} {{- if .Values.fullConfigMap }} - name: config mountPath: /fluent-bit/etc @@ -112,6 +117,12 @@ spec: - name: varlibdockercontainers hostPath: path: /var/lib/docker/containers + {{- if .Values.input.systemd.enabled }} + - name: etcmachineid + hostPath: + path: /etc/machine-id + type: File + {{- end }} {{- if .Values.backend.es.tls_ca }} - name: es-tls-secret secret: diff --git a/stable/fluent-bit/values.yaml b/stable/fluent-bit/values.yaml index 87ad3cf440..3a8eceae94 100644 --- a/stable/fluent-bit/values.yaml +++ b/stable/fluent-bit/values.yaml @@ -181,7 +181,16 @@ input: tail: memBufLimit: 5MB path: /var/log/containers/*.log - + systemd: + enabled: false + filters: + systemdUnit: + - docker.service + - kubelet.service + - node-problem-detector.service + maxEntries: 1000 + readFromTail: true + tag: host.* filter: kubeURL: https://kubernetes.default.svc:443