Skip to content

Commit bc1bb34

Browse files
committed
Fluent Bit sidecar archatecture. Complete POC
1 parent dfb58eb commit bc1bb34

File tree

7 files changed

+38
-261
lines changed

7 files changed

+38
-261
lines changed

charts/templates/configmap.yaml

Lines changed: 19 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -14,56 +14,25 @@ data:
1414
apiVersion: v1
1515
kind: ConfigMap
1616
metadata:
17-
name: fluentd-config
17+
name: {{ .Values.logging.configMapName }}
1818
namespace: {{ .Release.Namespace }}
19-
labels:
20-
kubernetes.io/cluster-service: "true"
2119
data:
22-
fluent.conf: |
23-
<match fluent.**>
24-
@type null
25-
</match>
26-
27-
<source>
28-
@type tail
29-
@id tail_marklogic_logs
30-
format none
31-
path /var/opt/MarkLogic/Logs/*
32-
pos_file /tmp/log/ml-logs.log.pos
33-
path_key log_file
34-
tag marklogic.logs
35-
read_from_head true
36-
<parse>
37-
@type none
38-
time_key @timestamp
39-
time_format %Y-%m-%dT%H:%M:%S.%N%z
40-
keep_time_key true
41-
</parse>
42-
</source>
43-
44-
<filter marklogic.logs>
45-
@type record_transformer
46-
enable_ruby true
47-
<record>
48-
# overwrite full path to file name
49-
log_file ${File.basename(record["log_file"])}
50-
</record>
51-
</filter>
52-
53-
<match marklogic.logs>
54-
@type elasticsearch
55-
host elasticsearch.default.svc.cluster.local
56-
port 9200
57-
user admin
58-
password admin
59-
index_name fluentd.${tag}
60-
include_timestamp true
61-
utc_index false
62-
time_key_format "%Y-%m-%dT%H:%M:%S.%N%z"
63-
time_key time
64-
logstash_format true
65-
logstash_prefix marklogic.logs
66-
path_key out/${log_file}
67-
flush_interval 1s
68-
</match>
20+
fluent-bit.conf: |
21+
[SERVICE]
22+
Flush 5
23+
Log_Level info
24+
Daemon off
25+
26+
[INPUT]
27+
Name tail
28+
Path {{ .Values.persistence.mountPath }}/Logs/*
29+
Tag marklogic-logs
30+
Path_Key path
6931
32+
[OUTPUT]
33+
Name es
34+
Match *
35+
Host {{ .Values.logging.host }}
36+
Port {{ .Values.logging.port }}
37+
HTTP_User {{ .Values.logging.username }}
38+
HTTP_Passwd {{ .Values.logging.password }}

charts/templates/statefulset.yaml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,20 @@ spec:
9696
{{- with .Values.resources }}
9797
resources: {{- toYaml . | nindent 12 }}
9898
{{- end }}
99-
- name: fluentd
100-
env:
101-
- name: FLUENT_UID
102-
value: root
103-
- name: FLUENT_CONF
104-
value: fluent.conf
105-
- name: FLUENTD_ARGS
106-
value: -c /fluentd/etc/fluent.conf
107-
image: saravak/fluentd:elastic
99+
{{- if .Values.logging.enabled }}
100+
- name: fluent-bit
101+
image: fluent/fluent-bit:latest
102+
imagePullPolicy: IfNotPresent
108103
volumeMounts:
109104
- name: datadir
110105
mountPath: {{ .Values.persistence.mountPath }}
111106
{{- if .Values.extraVolumeMounts }}
112107
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
113108
{{- end }}
114-
- name: fdconf
115-
mountPath: /fluentd/etc/
109+
- name: {{ .Values.logging.configMapName }}
110+
mountPath: /fluent-bit/etc/fluent-bit.conf
111+
subPath: fluent-bit.conf
112+
{{- end }}
116113
dnsConfig:
117114
searches:
118115
- {{ include "marklogic.headlessURL" . }}
@@ -121,9 +118,11 @@ spec:
121118
- name: {{ include "marklogic.fullname" . }}-registry
122119
{{- end }}
123120
volumes:
124-
- name: fdconf
121+
{{- if .Values.logging.enabled }}
122+
- name: {{ .Values.logging.configMapName }}
125123
configMap:
126-
name: fluentd-config
124+
name: {{ .Values.logging.configMapName }}
125+
{{- end }}
127126
{{- if or (not .Values.persistence.enabled) (.Values.extraVolumes) }}
128127
{{- if not .Values.persistence.enabled }}
129128
- name: datadir

charts/values.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,10 @@ startupProbe:
110110
failureThreshold: 30
111111
successThreshold: 1
112112

113+
logging:
114+
enabled: true
115+
username: admin
116+
password: admin
117+
configMapName: fluent-bit-config
118+
host: elasticsearch.default.svc.cluster.local
119+
port: 9200

logging/es-config.yaml

Lines changed: 0 additions & 92 deletions
This file was deleted.

logging/fd-configmap.yaml

Lines changed: 0 additions & 54 deletions
This file was deleted.

logging/kibana-config.yaml

Lines changed: 0 additions & 41 deletions
This file was deleted.

logging/reset.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)