-
Notifications
You must be signed in to change notification settings - Fork 35
/
log-contanier-file-filebeat.yaml
61 lines (60 loc) · 1.5 KB
/
log-contanier-file-filebeat.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
apiVersion: v1
kind: ConfigMap
metadata:
name: filebeat-config
data:
filebeat.yml: |
logging.level: warning
filebeat.inputs:
- type: log
# enabled: true
paths:
- "/log/*"
fields:
k8s-app: log-contanier-file-filebeat
output.elasticsearch:
hosts: ["elasticsearch-logging.logging:9200"]
indices:
- index: "filebeat-k8s-%{+YYYY.MM.dd}"
default: true
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: log-contanier-file-filebeat
labels:
k8s-app: log-contanier-file-filebeat
spec:
replicas: 1
selector:
matchLabels:
k8s-app: log-contanier-file-filebeat
template:
metadata:
labels:
k8s-app: log-contanier-file-filebeat
spec:
terminationGracePeriodSeconds: 30
containers:
- name: log-contanier-file-filebeat
image: alpine:latest
command:
- sh
- -c
- 'count=1;while true;do echo log to file $count>>/data/logs/log-contanier-file-filebeat.log;sleep 1;count=$(($count+1));done'
volumeMounts:
- name: app-logs
mountPath: /data/logs
- name: filebeat-logging
image: registry.cn-shanghai.aliyuncs.com/k8s-log/filebeat:6.3.2
volumeMounts:
- name: app-logs
mountPath: /log
- name: filebeat-config
mountPath: /usr/local/filebeat/config
volumes:
- name: app-logs
emptyDir: {}
- name: filebeat-config
configMap:
name: filebeat-config