-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfluentbit-sidecar.yml
99 lines (99 loc) · 2.34 KB
/
fluentbit-sidecar.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Collect Logs using FluentBit
# FluentBit as a sidecar.
# Application manages the log rotation.
---
apiVersion: v1
kind: ConfigMap
metadata:
name: fluentbit-config
data:
fluent-bit.conf: |-
[SERVICE]
Flush 1
Daemon Off
Log_Level debug
[INPUT]
Name tail
Path /var/log/*/*.log
Path_Key path
Refresh_Interval 5
Mem_Buf_Limit 20MB
Read_from_Head True
Skip_Long_Lines On
Ignore_Older 1d
DB /var/log/tail-containers-state.db
Key message
Tag raw.*
[FILTER]
Name record_modifier
Match *
Record pod ${HOSTNAME}
Record product ${PRODUCT}
Record hostname ${NODE_NAME}
Record namespace ${POD_NAMESPACE}
[OUTPUT]
Name forward
Match *
Host ${AGGREGATOR_HOST} # Fluentd as aggregator
Port 24224
Retry_Limit False
# Name es
# Match *
# Host elasticsearch-master.default.svc.cluster.local
# Port 9200
# HTTP_User elastic
# HTTP_Passwd <password>
# Logstash_Format On
# Retry_Limit False
# tls On
# tls.verify Off
---
apiVersion: v1
kind: Pod
metadata:
name: counter
spec:
containers:
- name: count
image: busybox
args:
- /bin/sh
- -c
- >
i=0;
while true;
do
echo "$i: $(date)" >> /var/log/counterbit/1.log;
echo "$(date) INFO $i" >> /var/log/counterbit/2.log;
i=$((i+1));
sleep 1;
done
volumeMounts:
- name: varlog
mountPath: /var/log/counterbit/
- name: fluentbit
image: fluent/fluent-bit:1.7
env:
- name: PRODUCT
value: myapp
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: AGGREGATOR_HOST
value: fluentd.default.svc.cluster.local
volumeMounts:
- name: varlog
mountPath: /var/log/counterbit/
- name: config-volume
mountPath: /fluent-bit/etc/
volumes:
- name: varlog
emptyDir: {}
- name: config-volume
configMap:
name: fluentbit-config