Rewrite match generator, add copy, null output

Change-Id: I2a00dafea1af6129b946be8c790ee1ea70801f8f
diff --git a/fluentd/files/filter/prometheus.conf b/fluentd/files/filter/prometheus.conf
index 0496d8d..7f8388f 100644
--- a/fluentd/files/filter/prometheus.conf
+++ b/fluentd/files/filter/prometheus.conf
@@ -3,11 +3,7 @@
   {%- if values.get('label') %}
   <labels>
     {%- for label in values.label %}
-      {%- if label.type == 'variable' %}
-    {{ label.name }} {%raw%}${{%-endraw%}{{ label.value }}{%raw%}}{%-endraw%}
-      {%- else %}
     {{ label.name }} {{ label.value }}
-      {%- endif %}
     {%- endfor %}
   </labels>
   {%- endif %}
diff --git a/fluentd/files/match/_generate.conf b/fluentd/files/match/_generate.conf
index 4ebcbae..23a2dfa 100644
--- a/fluentd/files/match/_generate.conf
+++ b/fluentd/files/match/_generate.conf
@@ -1,6 +1,8 @@
 {%- for name, values in salt['modelutils.order_by_requisites'](values).iteritems() %}
 {%- if values.get('enabled', True) %}
 # Output {{ name }}
+<match {{ values.tag }}>
 {% include 'fluentd/files/match/' + values.get('type') + '.conf' %}
+</match>
 {%- endif %}
 {%- endfor %}
diff --git a/fluentd/files/match/copy.conf b/fluentd/files/match/copy.conf
new file mode 100644
index 0000000..f59b977
--- /dev/null
+++ b/fluentd/files/match/copy.conf
@@ -0,0 +1,11 @@
+  @type copy
+  {%- for store in values.store %}
+  <store>
+  {%- with values=store %}
+    {%- set content %}
+      {%- include 'fluentd/files/match/' + store.get('type') + '.conf' %}
+    {%- endset %}
+  {{ content | indent(2, False) }}
+  {%- endwith %}
+  </store>
+  {%- endfor %}
diff --git a/fluentd/files/match/elasticsearch.conf b/fluentd/files/match/elasticsearch.conf
index 7e2b160..e26a313 100644
--- a/fluentd/files/match/elasticsearch.conf
+++ b/fluentd/files/match/elasticsearch.conf
@@ -1,4 +1,3 @@
-<match {{ values.tag }}>
   @type elasticsearch
   host {{ values.host }}
   port {{ values.get("port", 9200) }}
@@ -19,4 +18,3 @@
   {%- endwith %}
   </buffer>
 {%- endif %}
-</match>
diff --git a/fluentd/files/match/file.conf b/fluentd/files/match/file.conf
index 86e87ff..5eae9a7 100644
--- a/fluentd/files/match/file.conf
+++ b/fluentd/files/match/file.conf
@@ -1,4 +1,2 @@
-<match {{ values.tag }}>
   @type file
   path {{ values.path }}
-</match>
diff --git a/fluentd/files/match/null.conf b/fluentd/files/match/null.conf
new file mode 100644
index 0000000..c851b5a
--- /dev/null
+++ b/fluentd/files/match/null.conf
@@ -0,0 +1 @@
+  @type null
diff --git a/fluentd/files/match/relabel.conf b/fluentd/files/match/relabel.conf
index 88ca0c7..051cd43 100644
--- a/fluentd/files/match/relabel.conf
+++ b/fluentd/files/match/relabel.conf
@@ -1,4 +1,2 @@
-<match {{ values.tag }}>
   @type relabel
   @label @{{ values.label }}
-</match>
diff --git a/fluentd/files/match/rewrite_tag_filter.conf b/fluentd/files/match/rewrite_tag_filter.conf
index 3e8a164..911ead3 100644
--- a/fluentd/files/match/rewrite_tag_filter.conf
+++ b/fluentd/files/match/rewrite_tag_filter.conf
@@ -1,4 +1,3 @@
-<match {{ values.tag }}>
   @type rewrite_tag_filter
   {%- for rule in values.rule %}
   <rule>
@@ -7,4 +6,3 @@
     tag {{ rule.result }}
   </rule>
   {%- endfor %}
-</match>