-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathfluentd-forwarder-template.yaml
189 lines (183 loc) · 5.73 KB
/
fluentd-forwarder-template.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
---
apiVersion: v1
kind: Template
metadata:
name: fluentd-forwarder
annotations:
description: Template for collecting and forwarding fluentd logs to a remote log collection point like rsyslog or splunk.
labels:
name: fluentd-forwarder
objects:
- apiVersion: v1
kind: DeploymentConfig
metadata:
labels:
name: fluentd-forwarder
name: fluentd-forwarder
spec:
replicas: 1
triggers:
- type: ImageChange
imageChangeParams:
containerNames:
- fluentd-forwarder
from:
kind: ImageStreamTag
namespace: ${P_NAMESPACE}
name: ${P_IMAGE_NAME}:${P_IMAGE_VERSION}
- type: ConfigChange
selector:
name: fluentd-forwarder
template:
metadata:
labels:
name: fluentd-forwarder
spec:
containers:
- name: fluentd-forwarder
image: ${P_NAMESPACE}/${P_IMAGE_NAME}:${P_IMAGE_VERSION}
env:
- name: TARGET_TYPE
value: ${P_TARGET_TYPE}
- name: TARGET_HOST
value: ${P_TARGET_HOST}
- name: TARGET_PORT
value: ${P_TARGET_PORT}
- name: ADDITIONAL_OPTS
value: ${P_ADDITIONAL_OPTS}
- name: CA_PATH
value: ${P_CA_PATH}
- name: CERT_PATH
value: ${P_CERT_PATH}
- name: KEY_PATH
value: ${P_KEY_PATH}
- name: SHARED_KEY
value: ${P_SHARED_KEY}
volumeMounts:
- mountPath: /secrets
name: fluentd-forwarder-secret-mount
readOnly: true
- mountPath: /tmp/fluentd-config
name: fluentd-forwarder-config
readOnly: true
name: fluentd-forwarder
ports:
- containerPort: 24284
protocol: TCP
readinessProbe:
exec:
command:
- /opt/app-root/src/fluentd-check.sh
failureThreshold: 3
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
livenessProbe:
exec:
command:
- /opt/app-root/src/fluentd-check.sh
failureThreshold: 3
initialDelaySeconds: 15
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 5
volumes:
- name: fluentd-forwarder-secret-mount
secret:
secretName: fluentd-forwarder-certs
defaultMode: 420
- name: fluentd-forwarder-config
configMap:
name: fluentd-forwarder
defaultMode: 420
- apiVersion: v1
kind: Service
metadata:
annotations:
service.alpha.openshift.io/serving-cert-secret-name: fluentd-forwarder-certs
labels:
name: fluentd-forwarder
name: fluentd-forwarder
spec:
ports:
- name: fluentd-forwarder
port: 24284
protocol: TCP
targetPort: 24284
selector:
name: fluentd-forwarder
type: ClusterIP
- apiVersion: v1
kind: ConfigMap
metadata:
labels:
name: fluentd-forwarder
name: fluentd-forwarder
data:
fluentd.conf: |
<source>
@type secure_forward
self_hostname "#{ENV['HOSTNAME']}"
bind 0.0.0.0
port 24284
shared_key ${SHARED_KEY}
secure ${IS_SECURE}
enable_strict_verification ${STRICT_VERIFICATION}
ca_cert_path ${CA_PATH}
cert_path ${CERT_PATH}
private_key_path ${KEY_PATH}
private_key_passphrase ${KEY_PASSPHRASE}
</source>
<filter **>
@type record_transformer
<record>
forwarded_by "#{ENV['HOSTNAME']}"
source_component "OCP"
</record>
</filter>
<match **>
@type ${TARGET_TYPE}
host ${TARGET_HOST}
port ${TARGET_PORT}
${ADDITIONAL_OPTS}
</match>
parameters:
- name: P_NAMESPACE
description: Target namespace for image. Used to reference the ImageStream source for the image.
value: logging
required: true
- name: P_IMAGE_NAME
description: The name of the image to be used when performing the pull operation.
value: fluentd-forwarder
required: true
- name: P_IMAGE_VERSION
description: The version of the fluentd-forwarder image to use.
value: "latest"
- name: P_TARGET_TYPE
description: The output target's type. Can be 'remote_syslog' or 'splunk_ex'.
required: true
value: remote_syslog
- name: P_TARGET_HOST
description: The remote host that is the target for the logging data.
value: remote-syslog-host.lan
required: true
- name: P_TARGET_PORT
description: The remote port on the host that is the target for the logging data. The normal value for syslog is 514 and the normal value for splunk is 9997.
required: true
value: "514"
- name: P_ADDITIONAL_OPTS
description: Additional options passed to the forwarder plugin. The normal value for splunk is output_format json.
value: ""
- name: P_SHARED_KEY
description: "A key shared between the logging providers and this forwarder to ensure secure operation. Default: 'ocpaggregatedloggingsharedkey'."
value: ocpaggregatedloggingsharedkey
required: true
- name: P_CA_PATH
description: Path to the CA certificate required for certificate verification. By default it uses the OCP master's signing certificate.
value: /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt
- name: P_CERT_PATH
description: Path to the certificate that should be used to identify the server. Defaults to the path outlined for secret mount.
value: /secrets/tls.crt
- name: P_KEY_PATH
description: Path to the key that should be used for the server PKI. Defaults the the path outlined for secret mount.
value: /secrets/tls.key