-
Notifications
You must be signed in to change notification settings - Fork 35
/
nginx-log-fluentbit.yaml
106 lines (100 loc) · 2.19 KB
/
nginx-log-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
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
100
101
102
103
104
105
106
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-log-config
data:
default.conf: |
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-log-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/*
Key message
Tag nginx.access
Refresh_Interval 10
DB /fluent-bit/fluent-bit.db
[FILTER]
Name modify
Match *
Add_if_not_present k8s-app nginx-log-fluentbit
[OUTPUT]
Name forward
Match *
Host fluentd-shipper.logging
Port 24224
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-log-fluentbit
labels:
k8s-app: nginx-log-fluentbit
spec:
replicas: 1
selector:
matchLabels:
k8s-app: nginx-log-fluentbit
template:
metadata:
labels:
k8s-app: nginx-log-fluentbit
spec:
terminationGracePeriodSeconds: 30
containers:
- name: nginx-log-fluentbit
image: nginx:alpine
ports:
- containerPort: 80
volumeMounts:
- name: app-logs
mountPath: /var/log/nginx
- name: nginx-log-config
mountPath: /etc/nginx/conf.d/
- name: fluentbit-logging
image: fluent/fluent-bit:0.13
volumeMounts:
- name: app-logs
mountPath: /log
- name: nginx-log-fluentbit-config
mountPath: /fluent-bit/etc/
volumes:
- name: app-logs
emptyDir: {}
- name: nginx-log-config
configMap:
name: nginx-log-config
- name: nginx-log-fluentbit-config
configMap:
name: nginx-log-fluentbit-config
---
kind: Service
apiVersion: v1
metadata:
name: nginx-log-fluentbit
labels:
k8s-app: nginx-log-fluentbit
spec:
selector:
k8s-app: nginx-log-fluentbit
ports:
- name: http
port: 80