summaryrefslogtreecommitdiff
path: root/app/models/clusters/applications/fluentd.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
commit9f46488805e86b1bc341ea1620b866016c2ce5ed (patch)
treef9748c7e287041e37d6da49e0a29c9511dc34768 /app/models/clusters/applications/fluentd.rb
parentdfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff)
downloadgitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'app/models/clusters/applications/fluentd.rb')
-rw-r--r--app/models/clusters/applications/fluentd.rb20
1 files changed, 18 insertions, 2 deletions
diff --git a/app/models/clusters/applications/fluentd.rb b/app/models/clusters/applications/fluentd.rb
index a33b1e39ace..3fd6e870edc 100644
--- a/app/models/clusters/applications/fluentd.rb
+++ b/app/models/clusters/applications/fluentd.rb
@@ -4,6 +4,7 @@ module Clusters
module Applications
class Fluentd < ApplicationRecord
VERSION = '2.4.0'
+ CILIUM_CONTAINER_NAME = 'cilium-monitor'
self.table_name = 'clusters_applications_fluentd'
@@ -18,6 +19,8 @@ module Clusters
enum protocol: { tcp: 0, udp: 1 }
+ validate :has_at_least_one_log_enabled?
+
def chart
'stable/fluentd'
end
@@ -39,6 +42,12 @@ module Clusters
private
+ def has_at_least_one_log_enabled?
+ if !waf_log_enabled && !cilium_log_enabled
+ errors.add(:base, _("At least one logging option is required to be enabled"))
+ end
+ end
+
def content_values
YAML.load_file(chart_values_file).deep_merge!(specification)
end
@@ -62,7 +71,7 @@ module Clusters
program fluentd
hostname ${kubernetes_host}
protocol #{protocol}
- packet_size 65535
+ packet_size 131072
<buffer kubernetes_host>
</buffer>
<format>
@@ -85,7 +94,7 @@ module Clusters
<source>
@type tail
@id in_tail_container_logs
- path /var/log/containers/*#{Ingress::MODSECURITY_LOG_CONTAINER_NAME}*.log
+ path #{path_to_logs}
pos_file /var/log/fluentd-containers.log.pos
tag kubernetes.*
read_from_head true
@@ -96,6 +105,13 @@ module Clusters
</source>
EOF
end
+
+ def path_to_logs
+ path = []
+ path << "/var/log/containers/*#{Ingress::MODSECURITY_LOG_CONTAINER_NAME}*.log" if waf_log_enabled
+ path << "/var/log/containers/*#{CILIUM_CONTAINER_NAME}*.log" if cilium_log_enabled
+ path.join(',')
+ end
end
end
end