Skip to content

Commit 642ced5

Browse files
committed
Use specific version of fluent-bit
Setup parsing for request, access, and error logs Tag log files
1 parent bc1bb34 commit 642ced5

File tree

2 files changed

+116
-14
lines changed

2 files changed

+116
-14
lines changed

charts/templates/configmap.yaml

Lines changed: 112 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,119 @@ metadata:
1919
data:
2020
fluent-bit.conf: |
2121
[SERVICE]
22-
Flush 5
23-
Log_Level info
24-
Daemon off
22+
Flush 5
23+
Log_Level info
24+
Parsers_File parsers.conf
25+
Daemon off
26+
27+
[INPUT]
28+
Name tail
29+
Path {{ .Values.persistence.mountPath }}/Logs/*Error*
30+
Read_from_head true
31+
Tag kube.marklogic.logs.error
32+
Path_Key path
2533
2634
[INPUT]
27-
Name tail
28-
Path {{ .Values.persistence.mountPath }}/Logs/*
29-
Tag marklogic-logs
30-
Path_Key path
35+
Name tail
36+
Path {{ .Values.persistence.mountPath }}/Logs/*Access*
37+
Read_from_head true
38+
tag kube.marklogic.logs.access
39+
Path_Key path
40+
41+
[INPUT]
42+
Name tail
43+
Path {{ .Values.persistence.mountPath }}/Logs/*Request*
44+
Read_from_head true
45+
tag kube.marklogic.logs.request
46+
Path_Key path
47+
48+
[INPUT]
49+
Name tail
50+
Path {{ .Values.persistence.mountPath }}/Logs/CrashLog.txt
51+
Read_from_head true
52+
tag kube.marklogic.logs.crash
53+
Path_Key path
54+
55+
[INPUT]
56+
Name tail
57+
Path {{ .Values.persistence.mountPath }}/Logs/AuditLog.txt
58+
Read_from_head true
59+
tag kube.marklogic.logs.audit
60+
Path_Key path
61+
62+
[FILTER]
63+
Name modify
64+
Match kube.marklogic.logs.request
65+
Add tag kube.marklogic.logs.request
66+
67+
[FILTER]
68+
Name modify
69+
Match kube.marklogic.logs.audit
70+
Add tag kube.marklogic.logs.audit
71+
72+
[FILTER]
73+
Name modify
74+
Match kube.marklogic.logs.crash
75+
Add tag kube.marklogic.logs.crash
76+
77+
[FILTER]
78+
Name modify
79+
Match kube.marklogic.logs.access
80+
Add tag kube.marklogic.logs.access
81+
82+
[FILTER]
83+
Name modify
84+
Match kube.marklogic.logs.error
85+
Add tag kube.marklogic.logs.error
86+
87+
[FILTER]
88+
Name parser
89+
Match kube.marklogic.logs.error
90+
Key_Name log
91+
Parser error_parser
92+
Reserve_Data On
93+
94+
[FILTER]
95+
Name parser
96+
Match kube.marklogic.logs.access
97+
Key_Name log
98+
Parser access_parser
99+
Reserve_Data On
100+
101+
[FILTER]
102+
Name parser
103+
Match kube.marklogic.logs.request
104+
Key_Name log
105+
Parser json_parser
106+
Reserve_Data On
31107
32108
[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 }}
109+
Name es
110+
Match *
111+
Host {{ .Values.logging.host }}
112+
Port {{ .Values.logging.port }}
113+
HTTP_User {{ .Values.logging.username }}
114+
HTTP_Passwd {{ .Values.logging.password }}
115+
parsers.conf: |
116+
[PARSER]
117+
Name error_parser
118+
Format regex
119+
Regex ^(?<date_time>(.+?)(?=[a-zA-Z]))(?<log_level>(.+?)(?=:))(.+?)(?=[a-zA-Z])(?<log>.*)
120+
Time_Key date_time
121+
Time_Format %Y-%m-%d %H:%M:%S.%L
122+
Time_Keep On
123+
124+
[PARSER]
125+
Name access_parser
126+
Format regex
127+
Regex ^(?<host>[^ ]*)(.+?)(?<=\- )(?<user>(.+?)(?=\[))(.+?)(?<=\[)(?<date_time>(.+?)(?=\]))(.+?)(?<=")(?<request>[^\ ]+[^\"]+)(.+?)(?=\d)(?<response_code>[^\ ]*)(.+?)(?=\d|-)(?<response_obj_size>[^\ ]*)(.+?)(?=")(?<request_info>.*)
128+
Time_Key date_time
129+
Time_Format %d/%b/%Y:%H:%M:%S %z
130+
Time_Keep On
131+
132+
[PARSER]
133+
Name json_parser
134+
Format json
135+
Time_Key time
136+
Time_Format %Y-%m-%dT%H:%M:%S%z
137+
Time_Keep On

charts/templates/statefulset.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ spec:
9898
{{- end }}
9999
{{- if .Values.logging.enabled }}
100100
- name: fluent-bit
101-
image: fluent/fluent-bit:latest
101+
image: fluent/fluent-bit:1.9.7
102102
imagePullPolicy: IfNotPresent
103103
volumeMounts:
104104
- name: datadir
@@ -109,6 +109,9 @@ spec:
109109
- name: {{ .Values.logging.configMapName }}
110110
mountPath: /fluent-bit/etc/fluent-bit.conf
111111
subPath: fluent-bit.conf
112+
- name: {{ .Values.logging.configMapName }}
113+
mountPath: /fluent-bit/etc/parsers.conf
114+
subPath: parsers.conf
112115
{{- end }}
113116
dnsConfig:
114117
searches:

0 commit comments

Comments
 (0)