Skip to content

Commit b2cd645

Browse files
committed
update config for tha latest opensource beats version
1 parent 07a9acb commit b2cd645

File tree

3 files changed

+49
-55
lines changed

3 files changed

+49
-55
lines changed

filebeat.daemonset.yml

+29-14
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,34 @@
1-
apiVersion: extensions/v1beta1
1+
apiVersion: apps/v1
22
kind: DaemonSet
33
metadata:
44
namespace: kube-system
55
name: filebeat
66
labels:
77
app: filebeat
88
spec:
9+
selector:
10+
matchLabels:
11+
app: filebeat
912
template:
1013
metadata:
1114
labels:
12-
app: filebeat
15+
app: filebeat
1316
spec:
17+
tolerations:
18+
# these tolerations are to have the daemonset runnable on control plane nodes
19+
# remove them if your control plane nodes should not run pods
20+
- key: node-role.kubernetes.io/control-plane
21+
operator: Exists
22+
effect: NoSchedule
23+
- key: node-role.kubernetes.io/master
24+
operator: Exists
1425
serviceAccountName: filebeat
1526
terminationGracePeriodSeconds: 30
16-
# for openshift
17-
securityContext:
18-
runAsUser: 0
19-
privileged: true
27+
hostNetwork: true
28+
dnsPolicy: ClusterFirstWithHostNet
2029
containers:
2130
- name: filebeat
22-
image: docker.elastic.co/beats/filebeat:7.4.2
31+
image: docker.elastic.co/beats/filebeat:7.12.1
2332
args: [
2433
"-c", "/etc/filebeat.yml",
2534
"-e",
@@ -29,15 +38,25 @@ spec:
2938
value: 192.168.0.31
3039
- name: GRAYLOG_PORT
3140
value: "5042"
41+
#- name: ELASTICSEARCH_HOST
42+
# value: elasticsearch
43+
#- name: ELASTICSEARCH_PORT
44+
# value: "9200"
45+
#- name: ELASTICSEARCH_USERNAME
46+
# value: elastic
47+
#- name: ELASTICSEARCH_PASSWORD
48+
# value: changeme
3249
- name: NODE_NAME
3350
valueFrom:
3451
fieldRef:
3552
fieldPath: spec.nodeName
3653
securityContext:
3754
runAsUser: 0
55+
# If using Red Hat OpenShift uncomment this:
56+
#privileged: true
3857
resources:
3958
limits:
40-
memory: 200Mi
59+
memory: 200Mi
4160
requests:
4261
cpu: 100m
4362
memory: 100Mi
@@ -54,24 +73,20 @@ spec:
5473
- name: varlibdockercontainers
5574
mountPath: /var/lib/docker/containers
5675
readOnly: true
57-
- name: dockersock
58-
mountPath: /var/run/docker.sock
5976
volumes:
6077
- name: config
6178
configMap:
62-
defaultMode: 0600
79+
defaultMode: 0640
6380
name: filebeat-config
6481
- name: varlog
6582
hostPath:
6683
path: /var/log
6784
- name: varlibdockercontainers
6885
hostPath:
6986
path: /var/lib/docker/containers
70-
- name: dockersock
71-
hostPath:
72-
path: /var/run/docker.sock
7387
# data folder stores a registry of read status for all files, so we don't send everything again on a Filebeat pod restart
7488
- name: data
7589
hostPath:
90+
# When filebeat runs as non-root user, this directory needs to be writable by group (g+w).
7691
path: /var/lib/filebeat-data
7792
type: DirectoryOrCreate

filebeat.permission.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
2-
apiVersion: rbac.authorization.k8s.io/v1beta1
2+
apiVersion: rbac.authorization.k8s.io/v1
33
kind: ClusterRoleBinding
44
metadata:
5-
namespace: kube-system
65
name: filebeat
76
subjects:
87
- kind: ServiceAccount
@@ -13,10 +12,9 @@ roleRef:
1312
name: filebeat
1413
apiGroup: rbac.authorization.k8s.io
1514
---
16-
apiVersion: rbac.authorization.k8s.io/v1beta1
15+
apiVersion: rbac.authorization.k8s.io/v1
1716
kind: ClusterRole
1817
metadata:
19-
namespace: kube-system
2018
name: filebeat
2119
labels:
2220
app: filebeat
@@ -25,10 +23,15 @@ rules:
2523
resources:
2624
- namespaces
2725
- pods
26+
- nodes
2827
verbs:
2928
- get
3029
- watch
3130
- list
31+
- apiGroups: ["apps"]
32+
resources:
33+
- replicasets
34+
verbs: ["get", "list", "watch"]
3235
---
3336
apiVersion: v1
3437
kind: ServiceAccount

filebeat.settings.configmap.yml

+13-37
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
apiVersion: v1
23
kind: ConfigMap
34
metadata:
@@ -10,62 +11,37 @@ data:
1011
filebeat.inputs:
1112
- type: container
1213
paths:
13-
- /var/log/containers/*.log
14+
- /var/log/containers/*.log
1415
processors:
1516
- add_kubernetes_metadata:
16-
in_cluster: true
1717
host: ${NODE_NAME}
1818
matchers:
1919
- logs_path:
2020
logs_path: "/var/log/containers/"
2121
fields:
2222
cluster: cl02
2323
24-
filebeat.modules:
25-
- module: system
26-
syslog:
27-
enabled: true
28-
auth:
29-
enabled: true
30-
3124
filebeat.autodiscover:
3225
providers:
3326
- type: kubernetes
34-
templates:
35-
- condition.equals:
36-
kubernetes.labels.app: mongo
37-
config:
38-
- module: mongodb
39-
enabled: true
40-
log:
41-
input:
42-
type: docker
43-
containers.ids:
44-
- ${data.kubernetes.container.id}
27+
node: ${NODE_NAME}
28+
hints.enabled: true
29+
hints.default_config:
30+
type: container
31+
paths:
32+
- /var/log/containers/*${data.kubernetes.container.id}.log
4533
fields:
4634
cluster: cl02
4735
4836
processors:
49-
- drop_event:
50-
when.or:
51-
- and:
52-
- regexp:
53-
message: '^\d+\.\d+\.\d+\.\d+ '
54-
- equals:
55-
fileset.name: error
56-
- and:
57-
- not:
58-
regexp:
59-
message: '^\d+\.\d+\.\d+\.\d+ '
60-
- equals:
61-
fileset.name: access
6237
- add_cloud_metadata:
6338
- add_host_metadata:
64-
- add_kubernetes_metadata:
65-
- add_docker_metadata:
39+
- add_kubernetes_metadata
6640
6741
output.logstash:
6842
hosts: ['${GRAYLOG_HOST}:${GRAYLOG_PORT}']
6943
70-
setup.dashboards.enabled: false
71-
setup.template.enabled: false
44+
#output.elasticsearch:
45+
# hosts: ['${ELASTICSEARCH_HOST:elasticsearch}:${ELASTICSEARCH_PORT:9200}']
46+
# username: ${ELASTICSEARCH_USERNAME}
47+
# password: ${ELASTICSEARCH_PASSWORD}

0 commit comments

Comments
 (0)