From db08e7d2fe0877ec57644e02eb1357138c90d80b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20P?= <3164133+SebastienPi@users.noreply.github.com> Date: Fri, 8 Mar 2024 11:50:12 +0100 Subject: [PATCH] =?UTF-8?q?Improve=20doc=20for=C2=A0containerd/cri-o=20set?= =?UTF-8?q?up?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid lots of time to look at #434 and #571 Signed-off-by: Sébastien P <3164133+SebastienPi@users.noreply.github.com> --- fluentd-daemonset-elasticsearch-rbac.yaml | 18 ++++++++++++++++++ fluentd-daemonset-elasticsearch.yaml | 12 ++++++++++++ fluentd-daemonset-opensearch.yaml | 10 ++++++++-- templates/README.md.erb | 8 ++++++++ 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/fluentd-daemonset-elasticsearch-rbac.yaml b/fluentd-daemonset-elasticsearch-rbac.yaml index c313017be..488dc7a43 100644 --- a/fluentd-daemonset-elasticsearch-rbac.yaml +++ b/fluentd-daemonset-elasticsearch-rbac.yaml @@ -89,6 +89,24 @@ spec: value: "elastic" - name: FLUENT_ELASTICSEARCH_PASSWORD value: "changeme" + # Exclude Fluentd logs' to avoid an infine loop + # ================================================================ + - name: FLUENT_CONTAINER_TAIL_EXCLUDE_PATH + value: "/var/log/pods/fluent*" + # Option to configure containerd/cri-o log format + # ================================================================ + - name: FLUENT_CONTAINER_TAIL_PARSER_TYPE + value: "cri" + # Option to configure containerd date time log format + # ================================================================ + - name: FLUENT_CONTAINER_TAIL_PARSER_TIME_FORMAT + value: "%Y-%m-%dT%H:%M:%S.%N%:z" + # Logz.io Authentication + # ====================== + - name: LOGZIO_TOKEN + value: "ThisIsASuperLongToken" + - name: LOGZIO_LOGTYPE + value: "kubernetes" resources: limits: memory: 200Mi diff --git a/fluentd-daemonset-elasticsearch.yaml b/fluentd-daemonset-elasticsearch.yaml index 01b6c3dba..4c3084274 100644 --- a/fluentd-daemonset-elasticsearch.yaml +++ b/fluentd-daemonset-elasticsearch.yaml @@ -50,6 +50,18 @@ spec: value: "elastic" - name: FLUENT_ELASTICSEARCH_PASSWORD value: "changeme" + # Exclude Fluentd logs' to avoid an infine loop + # ================================================================ + - name: FLUENT_CONTAINER_TAIL_EXCLUDE_PATH + value: "/var/log/pods/fluent*" + # Option to configure containerd/cri-o log format + # ================================================================ + - name: FLUENT_CONTAINER_TAIL_PARSER_TYPE + value: "cri" + # Option to configure containerd date time log format + # ================================================================ + - name: FLUENT_CONTAINER_TAIL_PARSER_TIME_FORMAT + value: "%Y-%m-%dT%H:%M:%S.%N%:z" # Logz.io Authentication # ====================== - name: LOGZIO_TOKEN diff --git a/fluentd-daemonset-opensearch.yaml b/fluentd-daemonset-opensearch.yaml index 0ae23dfa3..fc39e763e 100644 --- a/fluentd-daemonset-opensearch.yaml +++ b/fluentd-daemonset-opensearch.yaml @@ -60,10 +60,16 @@ spec: value: "/path/to/file.key" - name: FLUENT_OPENSEARCH_CLIENT_KEY_PASS value: "changeme" - # Fluentd Parser - # ===================== + # Exclude Fluentd logs' to avoid an infine loop + # ================================================================ + - name: FLUENT_CONTAINER_TAIL_EXCLUDE_PATH + value: "/var/log/pods/fluent*" + # Option to configure containerd/cri-o log format + # ================================================================ - name: FLUENT_CONTAINER_TAIL_PARSER_TYPE value: "cri" + # Option to configure containerd date time log format + # ================================================================ - name: FLUENT_CONTAINER_TAIL_PARSER_TIME_FORMAT value: "%Y-%m-%dT%H:%M:%S.%N%:z" resources: diff --git a/templates/README.md.erb b/templates/README.md.erb index 77e72e395..15f377725 100644 --- a/templates/README.md.erb +++ b/templates/README.md.erb @@ -167,6 +167,14 @@ You can use `cri` parser by overwriting `tail_container_parse.conf` via ConfigMa ``` +Or by setting environment variables `FLUENT_CONTAINER_TAIL_PARSER_TYPE` and/or `FLUENT_CONTAINER_TAIL_PARSER_TIME_FORMAT` according to your setup. +``` +- name: FLUENT_CONTAINER_TAIL_PARSER_TYPE + value: "cri" +- name: FLUENT_CONTAINER_TAIL_PARSER_TIME_FORMAT + value: "%Y-%m-%dT%H:%M:%S.%N%:z" +``` + See also [CRI parser README](https://github.com/fluent/fluent-plugin-parser-cri#log-and-configuration-example) ### Use FLUENT_CONTAINER_TAIL_PATH to change container logs folder