Skip to content

Instantly share code, notes, and snippets.

@pivotaljohn
Last active March 31, 2023 17:13
Show Gist options
  • Save pivotaljohn/bb699be0be255e310f1481b31cf2d635 to your computer and use it in GitHub Desktop.
Save pivotaljohn/bb699be0be255e310f1481b31cf2d635 to your computer and use it in GitHub Desktop.
Ensuring no embedded spaces in multiline string
apiVersion: v1
kind: ConfigMap
metadata:
name: fluent-bit-config
namespace: fluent-bit
labels:
k8s-app: fluent-bit
data:
#@ load("@ytt:data", "data")
#@ load("@ytt:overlay", "overlay")
#@overlay/match by=overlay.subset({"kind":"ConfigMap"}), expects=1
---
data:
#@yaml/text-templated-strings
#@overlay/replace
fluent-bit.conf: |
(@= data.values.fluent_bit.config.service -@)
Parsers_File parsers.conf
(@= " Plugins_File plugins.conf" if data.values.fluent_bit.config.plugins else "" -@)
(@= " Streams_File streams.conf" if data.values.fluent_bit.config.streams else "" -@)
@INCLUDE inputs.conf
@INCLUDE filters.conf
@INCLUDE outputs.conf
#@yaml/text-templated-strings
#@overlay/replace
outputs.conf: (@= data.values.fluent_bit.config.outputs @)
#@yaml/text-templated-strings
#@overlay/replace
inputs.conf: (@= data.values.fluent_bit.config.inputs @)
#@yaml/text-templated-strings
#@overlay/replace
filters.conf: (@= data.values.fluent_bit.config.filters @)
#@yaml/text-templated-strings
#@overlay/replace
parsers.conf: (@= data.values.fluent_bit.config.parsers @)
#@yaml/text-templated-strings
#@overlay/replace
streams.conf: (@= data.values.fluent_bit.config.streams @)
#@yaml/text-templated-strings
#@overlay/replace
plugins.conf: (@= data.values.fluent_bit.config.plugins @)
#@data/values
#@overlay/match-child-defaults missing_ok=True
---
namespace: "fluent-bit"
#! Required params for supported output plugins
fluent_bit:
config:
#! https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/variables
outputs: |
[OUTPUT]
Name stdout
Match *
inputs: |
[INPUT]
Name tail
Path /var/log/containers/*.log
Parser docker
Tag kube.*
Mem_Buf_Limit 5MB
Skip_Long_Lines On
[INPUT]
Name systemd
Tag host.*
Systemd_Filter _SYSTEMD_UNIT=kubelet.service
Read_From_Tail On
service: |
[Service]
Flush 1
Log_Level info
Daemon off
Parsers_File parsers.conf
HTTP_Server On
HTTP_Listen 0.0.0.0
HTTP_Port 2020
filters: |
[FILTER]
Name kubernetes
Match kube.*
Kube_URL https://kubernetes.default.svc:443
Kube_CA_File /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
Kube_Token_File /var/run/secrets/kubernetes.io/serviceaccount/token
Kube_Tag_Prefix kube.var.log.containers.
Merge_Log On
Merge_Log_Key log_processed
K8S-Logging.Parser On
K8S-Logging.Exclude On
parsers: |
# see https://github.com/fluent/fluent-bit/blob/v1.7.5/conf/parsers.conf
[PARSER]
Name apache
Format regex
Regex ^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$
Time_Key time
Time_Format %d/%b/%Y:%H:%M:%S %z
streams: ""
plugins: ""
#! optional configuration for the daemonset
daemonset:
resources: { }
#! limits:
#! cpu: 100m
#! memory: 128Mi
#! requests:
#! cpu: 100m
#! memory: 128Mi
podAnnotations: { }
podLabels: { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment