Add fluentd support to Haproxy
Change-Id: I7e33085925d9a6bd56e2b37751e31f2df2ce3f33
diff --git a/haproxy/meta/fluentd.yml b/haproxy/meta/fluentd.yml
new file mode 100644
index 0000000..a5e1c95
--- /dev/null
+++ b/haproxy/meta/fluentd.yml
@@ -0,0 +1,36 @@
+{%- if pillar.get('fluentd', {}).get('agent', {}).get('enabled', False) %}
+agent:
+ config:
+ label:
+ haproxy:
+ input:
+ tail_haproxy:
+ type: tail
+ tag: haproxy.general
+ path: /var/log/haproxy.log
+ pos_file: {{ pillar.fluentd.agent.dir.positiondb }}/haproxy.pos
+ parser:
+ type: regexp
+ time_key: time
+ time_format: '%FT%H:%M:%S.%L%z'
+ keep_time_key: false
+ format: '/^\<(?<priority>[0-9]+)\>(?<time>[^ ]*) (?<host>[^ ]*) haproxy\[(?<pid>[0-9]+)\]?: *(?<Payload>.*)$/'
+ filter:
+ match_severity:
+ type: record_transformer
+ tag: haproxy.**
+ enable_ruby: true
+ remove_keys: priority
+ record:
+ - name: programname
+ value: haproxy
+ - name: Severity
+ value: "${ record['priority'].to_i % 8 }"
+ - name: severity_label
+ value: "${ {'DEBUG'=>7,'INFO'=>6,'NOTICE'=>5,'WARNING'=>4,'ERROR'=>3,'CRITICAL'=>2,'ALERT'=>1}.key(record['priority'].to_i % 8) }"
+ match:
+ push_to_default:
+ tag: haproxy.**
+ type: relabel
+ label: default_output
+{%- endif %}
diff --git a/metadata/service/support.yml b/metadata/service/support.yml
index 50c8d01..767cc82 100644
--- a/metadata/service/support.yml
+++ b/metadata/service/support.yml
@@ -15,3 +15,5 @@
enabled: true
prometheus:
enabled: true
+ fluentd:
+ enabled: true