-
Notifications
You must be signed in to change notification settings - Fork 35
/
log-contanier-file-fluentbit.yaml
73 lines (69 loc) · 1.7 KB
/
log-contanier-file-fluentbit.yaml
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
apiVersion: v1
kind: ConfigMap
metadata:
name: fluentbit-config
data:
fluent-bit.conf: |
[SERVICE]
Flush 5
Daemon off
Log_Level error
Log_File /fluent-bit/log/fluent-bit.log
[INPUT]
Name tail
Path /log/*
Refresh_Interval 10
DB /fluent-bit/fluent-bit.db
[FILTER]
Name modify
Match *
Add_if_not_present k8s-app log-contanier-file-fluentbit
[OUTPUT]
Name es
Match *
Host elasticsearch-logging.logging
Port 9200
Logstash_Format On
Logstash_Prefix fluentbit-k8s
Logstash_DateFormat %Y.%m.%d
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: log-contanier-file-fluentbit
labels:
k8s-app: log-contanier-file-fluentbit
spec:
replicas: 1
selector:
matchLabels:
k8s-app: log-contanier-file-fluentbit
template:
metadata:
labels:
k8s-app: log-contanier-file-fluentbit
spec:
terminationGracePeriodSeconds: 30
containers:
- name: log-contanier-file-fluentbit
image: alpine:latest
command:
- sh
- -c
- 'count=1;while true;do echo log to file $count>>/data/logs/log-contanier-file-fluentbit.log;sleep 1;count=$(($count+1));done'
volumeMounts:
- name: app-logs
mountPath: /data/logs
- name: fluentbit-logging
image: fluent/fluent-bit:0.13
volumeMounts:
- name: app-logs
mountPath: /log
- name: fluentbit-config
mountPath: /fluent-bit/etc/
volumes:
- name: app-logs
emptyDir: {}
- name: fluentbit-config
configMap:
name: fluentbit-config