#!/bin/bash
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
set -xe
: ${OSH_INFRA_HELM_REPO:="../openstack-helm-infra"}
: ${OSH_INFRA_VALUES_OVERRIDES_PATH:="../openstack-helm-infra/values_overrides"}
: ${OSH_INFRA_EXTRA_HELM_ARGS_FLUENTD:="$(helm osh get-values-overrides -p ${OSH_INFRA_VALUES_OVERRIDES_PATH} -c fluentd ${FEATURES})"}
tee /tmp/fluentd.yaml << EOF
pod:
env:
fluentd:
vars:
MY_TEST_VAR: FOO
secrets:
MY_TEST_SECRET: BAR
conf:
fluentd:
conf:
# These fields are rendered as helm templates
input: |
@type prometheus
port {{ tuple "fluentd" "internal" "metrics" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
@type prometheus_monitor
@type prometheus_output_monitor
@type prometheus_tail_monitor
bind 0.0.0.0
port "#{ENV['FLUENTD_PORT']}"
@type forward
@type tail
@id in_tail_container_logs
path "/var/log/containers/*.log"
pos_file "/var/log/fluentd-containers.log.pos"
tag kubernetes.*
read_from_head true
emit_unmatched_lines true
@type "multi_format"
format json
time_key "time"
time_type string
time_format "%Y-%m-%dT%H:%M:%S.%NZ"
keep_time_key false
format regexp
expression /^(?
@type tail
tag libvirt.*
path /var/log/libvirt/**.log
pos_file "/var/log/fluentd-libvirt.log.pos"
read_from_head true
@type none
@type systemd
tag auth
path /var/log/journal
matches [{ "SYSLOG_FACILITY":"10" }]
read_from_head true
@type local
path /var/log/fluentd-systemd-auth.json
fields_strip_underscores true
fields_lowercase true
@type systemd
tag journal.*
path /var/log/journal
matches [{ "_SYSTEMD_UNIT": "docker.service" }]
read_from_head true
@type local
path /var/log/fluentd-systemd-docker.json
fields_strip_underscores true
fields_lowercase true
@type systemd
tag journal.*
path /var/log/journal
matches [{ "_SYSTEMD_UNIT": "kubelet.service" }]
read_from_head true
@type local
path /var/log/fluentd-systemd-kubelet.json
fields_strip_underscores true
fields_lowercase true
@type systemd
tag kernel
path /var/log/journal
matches [{ "_TRANSPORT": "kernel" }]
read_from_head true
@type local
path /var/log/fluentd-systemd-kernel.json
fields_strip_underscores true
fields_lowercase true
@type relabel
@label @filter
filter: |
output: |
EOF
helm upgrade --install fluentd ${OSH_INFRA_HELM_REPO}/fluentd \
--namespace=osh-infra \
--values=/tmp/fluentd.yaml \
${OSH_INFRA_EXTRA_HELM_ARGS} \
${OSH_INFRA_EXTRA_HELM_ARGS_FLUENTD}
#NOTE: Wait for deploy
helm osh wait-for-pods osh-infra