Add telegraf label
Change-Id: I83523030c409f861e8cd0f62258dd2dbd8b13e15
Related-bug: PROD-28142 (PROD:28142)
diff --git a/metadata/service/support.yml b/metadata/service/support.yml
index a4b5e81..21ff9f2 100644
--- a/metadata/service/support.yml
+++ b/metadata/service/support.yml
@@ -1,5 +1,8 @@
parameters:
telegraf:
_support:
+ fluentd:
+ enabled: true
prometheus:
enabled: true
+
diff --git a/telegraf/meta/fluentd.yml b/telegraf/meta/fluentd.yml
new file mode 100644
index 0000000..98ec4f4
--- /dev/null
+++ b/telegraf/meta/fluentd.yml
@@ -0,0 +1,35 @@
+{%- if pillar.get('fluentd', {}).get('agent', {}).get('enabled', False) %}
+{%- set positiondb = pillar.fluentd.agent.dir.positiondb %}
+{%- if grains.get('init') == 'systemd' %}
+agent:
+ plugin:
+ fluent-plugin-systemd:
+ deb: ['td-agent-additional-plugins']
+ config:
+ label:
+ telegraf:
+ filter:
+ add_severity_label:
+ tag: '**'
+ type: record_transformer
+ enable_ruby: true
+ record:
+ - name: severity_label
+ value: '${ if record["Payload"].include? "E!"; "ERROR"; elsif record["Payload"].include? "W!"; "WARNING"; elsif record["Payload"].include? "D!"; "DEBUG"; else; record["severity_label"]; end }'
+ add_severity:
+ require:
+ - add_severity_label
+ tag: '**'
+ type: record_transformer
+ enable_ruby: true
+ record:
+ - name: Severity
+ value: '${ { 8=>"TRACE",7=>"DEBUG",6=>"INFO",5=>"NOTICE",4=>"WARNING",3=>"ERROR",2=>"CRITICAL",1=>"ALERT",0=>"EMERGENCY" }.key(record["severity_label"]) }'
+ match:
+ push_to_default:
+ tag: '**'
+ type: relabel
+ label: default_output
+{%- endif %}
+{%- endif %}
+