Skip to content

Commit 107077c

Browse files
committed
Configured monitoring and logging with fluentd
1 parent f21ce84 commit 107077c

File tree

10 files changed

+652
-127
lines changed

10 files changed

+652
-127
lines changed

apps/cicd/jenkins/install.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
kubectl create namespace cicd
4+
5+
helm install jenkins jenkinsci/jenkins --values values.yaml --namespace cicd

apps/monitoring/install.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
kubectl create namespace monitoring
4+
5+
helm install prometheus prometheus-community/prometheus --values prometheus/values.yaml --namespace monitoring
6+
helm install grafana stable/grafana --values grafana/values.yaml --namespace monitoring

apps/system/elk/elasticsearch/values.yaml renamed to apps/system/efk/elasticsearch/values.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ secretMounts: []
5151
# defaultMode: 0755
5252

5353
image: "docker.elastic.co/elasticsearch/elasticsearch"
54-
imageTag: "7.9.1"
54+
imageTag: "7.9.2"
5555
imagePullPolicy: "IfNotPresent"
5656

5757
podAnnotations: {}
@@ -122,6 +122,7 @@ persistence:
122122
labels:
123123
# Add default labels for the volumeClaimTemplate fo the StatefulSet
124124
enabled: false
125+
storageClassName: "nfs"
125126
annotations: {}
126127

127128
extraVolumes: []
@@ -182,6 +183,7 @@ service:
182183
transportPortName: transport
183184
loadBalancerIP: ""
184185
loadBalancerSourceRanges: []
186+
externalTrafficPolicy: ""
185187

186188
updateStrategy: RollingUpdate
187189

@@ -230,7 +232,7 @@ tolerations: []
230232
# Only enable this if you have security enabled on your cluster
231233
ingress:
232234
enabled: true
233-
annotations:
235+
annotations:
234236
kubernetes.io/ingress.class: nginx
235237
# kubernetes.io/tls-acme: "true"
236238
path: /
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: fluent-bit-config
5+
namespace: kube-logging
6+
labels:
7+
k8s-app: fluent-bit
8+
data:
9+
# Configuration files: server, input, filters and output
10+
# ======================================================
11+
fluent-bit.conf: |
12+
[SERVICE]
13+
Flush 1
14+
Log_Level info
15+
Daemon off
16+
Parsers_File parsers.conf
17+
HTTP_Server On
18+
HTTP_Listen 0.0.0.0
19+
HTTP_Port 2020
20+
21+
@INCLUDE input-kubernetes.conf
22+
@INCLUDE filter-kubernetes.conf
23+
@INCLUDE output-elasticsearch.conf
24+
25+
input-kubernetes.conf: |
26+
[INPUT]
27+
Name tail
28+
Tag kube.*
29+
Path /var/log/containers/*.log
30+
Parser docker
31+
DB /var/log/flb_kube.db
32+
Mem_Buf_Limit 5MB
33+
Skip_Long_Lines On
34+
Refresh_Interval 10
35+
36+
filter-kubernetes.conf: |
37+
[FILTER]
38+
Name kubernetes
39+
Match kube.*
40+
Kube_URL https://kubernetes.default.svc:443
41+
Kube_CA_File /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
42+
Kube_Token_File /var/run/secrets/kubernetes.io/serviceaccount/token
43+
Kube_Tag_Prefix kube.var.log.containers.
44+
Merge_Log On
45+
Merge_Log_Key log_processed
46+
K8S-Logging.Parser On
47+
K8S-Logging.Exclude Off
48+
49+
output-elasticsearch.conf: |
50+
[OUTPUT]
51+
Name es
52+
Match *
53+
Host elasticsearch-master
54+
Port 9200
55+
Logstash_Format On
56+
Replace_Dots On
57+
Retry_Limit False
58+
59+
parsers.conf: |
60+
[PARSER]
61+
Name apache
62+
Format regex
63+
Regex ^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$
64+
Time_Key time
65+
Time_Format %d/%b/%Y:%H:%M:%S %z
66+
67+
[PARSER]
68+
Name apache2
69+
Format regex
70+
Regex ^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^ ]*) +\S*)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$
71+
Time_Key time
72+
Time_Format %d/%b/%Y:%H:%M:%S %z
73+
74+
[PARSER]
75+
Name apache_error
76+
Format regex
77+
Regex ^\[[^ ]* (?<time>[^\]]*)\] \[(?<level>[^\]]*)\](?: \[pid (?<pid>[^\]]*)\])?( \[client (?<client>[^\]]*)\])? (?<message>.*)$
78+
79+
[PARSER]
80+
Name nginx
81+
Format regex
82+
Regex ^(?<remote>[^ ]*) (?<host>[^ ]*) (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$
83+
Time_Key time
84+
Time_Format %d/%b/%Y:%H:%M:%S %z
85+
86+
[PARSER]
87+
Name json
88+
Format json
89+
Time_Key time
90+
Time_Format %d/%b/%Y:%H:%M:%S %z
91+
92+
[PARSER]
93+
Name docker
94+
Format json
95+
Time_Key time
96+
Time_Format %Y-%m-%dT%H:%M:%S.%L
97+
Time_Keep On
98+
99+
[PARSER]
100+
Name syslog
101+
Format regex
102+
Regex ^\<(?<pri>[0-9]+)\>(?<time>[^ ]* {1,2}[^ ]* [^ ]*) (?<host>[^ ]*) (?<ident>[a-zA-Z0-9_\/\.\-]*)(?:\[(?<pid>[0-9]+)\])?(?:[^\:]*\:)? *(?<message>.*)$
103+
Time_Key time
104+
Time_Format %b %d %H:%M:%S

0 commit comments

Comments
 (0)