Compress image using xz
[ta/caas-logging.git] / ansible / roles / fluentd / templates / fluentd-cm.yaml
1 {#
2 Copyright 2019 Nokia
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8     http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 #}
16 ---
17 apiVersion: v1
18 kind: ConfigMap
19 metadata:
20   name: fluentd-cm
21   namespace: kube-system
22 data:
23   #Take care that the files will be processed by fluentd in alphabetical order
24   01-fluentd_kubernetes.conf: |-
25
26     # Look for files of type *kube-system* and add tag kubernetes
27     <source>
28       @type tail
29       path /var/log/containers/*kube-system*.log
30       pos_file /fluentd/log/fluentd-kubernetes.log.pos
31       time_format %Y-%m-%dT%H:%M:%S.%NZ
32       tag kubernetes.*
33       format json
34       read_from_head true
35     </source>
36     # Add kubernetes metadata to "kubernetes" tagged messages
37     <filter kubernetes.**>
38       @type kubernetes_metadata
39     </filter>
40
41   02-fluentd_elasticsearch.conf: |-
42
43     # Forward all messages with either kubenetes tag to elasticsearch
44     <match kubernetes**>
45        @type elasticsearch
46        @log_level info
47        include_tag_key true
48        host "{{ caas.elasticsearch_url }}"
49        port "{{ caas.elasticsearch_port }}"
50        scheme "{{ elasticsearch_sheme | default('http') }}"
51        user "{{ elasticsearch_user | default('elastic') }}"
52        password "{{ elasticsearch_passwd | default('changeme') }}"
53        ssl_verify  "{{ elasticsearch_ssl | default('true') }}"
54        reload_connections "{{ elasticsearch_reload_connections | default('true') }}"
55        logstash_prefix "{{ elasticsearch_logstash_prefix | default('logstash') }}"
56        logstash_format true
57        reconnect_on_error true
58        resurrect_after 5s
59        <buffer tag>
60           chunk_limit_size 256m
61           flush_at_shutdown "true"
62           flush_interval 5s
63       </buffer>
64     </match>