Merge "Update fluentd templates" into release/2019.2.0
diff --git a/fluentd/files/input/prometheus.conf b/fluentd/files/input/prometheus.conf
new file mode 100644
index 0000000..0a9bffd
--- /dev/null
+++ b/fluentd/files/input/prometheus.conf
@@ -0,0 +1,19 @@
+{% from "fluentd/map.jinja" import agent with context %}
+<source>
+{% include 'fluentd/files/input/_general.conf' %}
+  {%- if values.port is defined %}
+  port {{ values.port }}
+  {%- endif %}
+  {%- if values.bind is defined %}
+  bind {{ values.bind }}
+  {%- endif %}
+  metrics_path {{ values.get("metrics_path", "/metrics") }}
+  {%- if values.ssl is defined and values.ssl.get("enabled") %}
+  <ssl>
+    enable true
+    certificate_path {{ agent.dir.config }}/fluentd-prometheus.crt
+    private_key_path {{ agent.dir.config }}/fluentd-prometheus.key
+    ca_path /etc/ssl/certs/ca-certificates.crt
+  </ssl>
+  {%- endif %}
+</source>
diff --git a/fluentd/files/match/elasticsearch.conf b/fluentd/files/match/elasticsearch.conf
index f966b22..a9f1411 100644
--- a/fluentd/files/match/elasticsearch.conf
+++ b/fluentd/files/match/elasticsearch.conf
@@ -1,6 +1,12 @@
   @type elasticsearch
   host {{ values.host }}
   port {{ values.get("port", 9200) }}
+  scheme {{ values.get("scheme", "http") }}
+{%- if values.get("scheme", "http") == "https" %}
+  ssl_verify true
+  ca_file /etc/ssl/certs/ca-certificates.crt
+  ssl_version TLSv1_2
+{%- endif %}
   type_name {{ values.get("es_type_name", "message") }}
   tag_key {{ values.get("tag_key", "Logger") }}
   include_tag_key true
diff --git a/fluentd/meta/prometheus.yml b/fluentd/meta/prometheus.yml
index ef438c1..8a0d3fa 100644
--- a/fluentd/meta/prometheus.yml
+++ b/fluentd/meta/prometheus.yml
@@ -12,6 +12,12 @@
   target:
     static:
       fluentd:
+    {%- if fluentd_agent.get('config', {}).get('input', {}).get('prometheus', {}).get('metric', {}).get('ssl', {}).get('enabled', False) %}
+        scheme: https
+        tls_config:
+          skip_verify: False
+          ca_file: /etc/ssl/certs/ca-certificates.crt
+    {%- endif %}
         endpoint:
           - address: {{ address }}
             port: 24231
diff --git a/metadata/service/agent/single.yml b/metadata/service/agent/single.yml
index b4ea1c1..38eda02 100644
--- a/metadata/service/agent/single.yml
+++ b/metadata/service/agent/single.yml
@@ -9,3 +9,4 @@
       enabled: true
       dir:
         positiondb: /var/lib/fluentd/positiondb
+        config: /etc/td-agent