diff --git a/README.md b/README.md index d8a4f1514d9aafc4fde396c209d5f079933d0d32..190cfd273a219f05c9df4f55ad55c4042608abc4 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,44 @@ -# fluentbit +# Fluentbit +Manifests pulled from official Fluentbit docs [here](https://docs.fluentbit.io/manual/installation/kubernetes). + +Most of the time, you will have to use kustomize to patch elasticsearch usernames and passwords. We don't include it here cause nothing in this repo will be responsible for creating the secrets in kubernetes. + +Check this out: + +kustomization.yaml +``` +namespace: elastic + +bases: + - fluentbit-pkg/ + +patchesStrategicMerge: +- patch.yaml + +``` + + +patch.yaml +``` +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: fluent-bit +spec: + template: + spec: + containers: + - name: fluent-bit + env: + - name: FLUENT_ELASTICSEARCH_HOST + value: elasticsearch-es-http + - name: FLUENT_ELASTICSEARCH_USER + value: elastic + - name: FLUENT_ELASTICSEARCH_PASS + valueFrom: + secretKeyRef: + name: elasticsearch-es-elastic-user + key: elastic + +``` \ No newline at end of file diff --git a/config-map.yaml b/config-map.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e723323fbeb58f3e45ab6b760a4d93ee7f509cc8 --- /dev/null +++ b/config-map.yaml @@ -0,0 +1,106 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: fluent-bit-config + labels: + k8s-app: fluent-bit +data: + # Configuration files: server, input, filters and output + # ====================================================== + fluent-bit.conf: | + [SERVICE] + Flush 1 + Log_Level info + Daemon off + Parsers_File parsers.conf + HTTP_Server On + HTTP_Listen 0.0.0.0 + HTTP_Port 2020 + + @INCLUDE input-kubernetes.conf + @INCLUDE filter-kubernetes.conf + @INCLUDE output-elasticsearch.conf + + input-kubernetes.conf: | + [INPUT] + Name tail + Tag kube.* + Path /var/log/containers/*.log + Parser docker + DB /var/log/flb_kube.db + Mem_Buf_Limit 5MB + Skip_Long_Lines On + Refresh_Interval 10 + + filter-kubernetes.conf: | + [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 + + output-elasticsearch.conf: | + [OUTPUT] + Name es + Match * + Host ${FLUENT_ELASTICSEARCH_HOST} + Port 9200 + HTTP_User ${FLUENT_ELASTICSEARCH_USER} + HTTP_Passwd ${FLUENT_ELASTICSEARCH_PASS} + Logstash_Format On + Replace_Dots On + Retry_Limit False + Logstash_Prefix kubernetes + + parsers.conf: | + [PARSER] + Name apache + Format regex + Regex ^(?[^ ]*) [^ ]* (?[^ ]*) \[(?