Merge "Optimize kitchen tests for Travis CI"
diff --git a/elasticsearch/client/init.sls b/elasticsearch/client/init.sls
index c169e97..058f98e 100644
--- a/elasticsearch/client/init.sls
+++ b/elasticsearch/client/init.sls
@@ -43,8 +43,13 @@
   module.run:
     - name: elasticsearch.index_{{ operation }}
     - index: {{ index_name }}-{{ curdate }}
+{%- else %}
+elasticsearch_index_{{ index_name }}_{{ operation }}:
+  module.run:
+    - name: elasticsearch.index_{{ operation }}
+    - index: {{ index_name }}
 {%- endif %}
 
 {%- endfor %}
 
-{%- endif %}
\ No newline at end of file
+{%- endif %}
diff --git a/elasticsearch/files/grafana_dashboards/elasticsearch_prometheus.json b/elasticsearch/files/grafana_dashboards/elasticsearch_prometheus.json
index bfb92dd..f490248 100644
--- a/elasticsearch/files/grafana_dashboards/elasticsearch_prometheus.json
+++ b/elasticsearch/files/grafana_dashboards/elasticsearch_prometheus.json
@@ -1863,10 +1863,10 @@
         "multi": false,
         "name": "host",
         "options": [],
-        "query": "query_result(elasticsearch_os_load_average)",
+        "query": "query_result(elasticsearch_up)",
         "refresh": 1,
         "refresh_on_load": true,
-        "regex": ".*,host=\"(.+?\\d+)\".*",
+        "regex": ".*host=\"(.+?\\d+)\".*",
         "sort": 1,
         "tagValuesQuery": "",
         "tags": [],
diff --git a/elasticsearch/map.jinja b/elasticsearch/map.jinja
index b69b369..056beed 100644
--- a/elasticsearch/map.jinja
+++ b/elasticsearch/map.jinja
@@ -16,7 +16,7 @@
   service: elasticsearch
   version: '1.4.4'
 default:
-  version: 2
+  version: 5
 {%- endload %}
 
 {%- set server = salt['grains.filter_by'](base_defaults, merge=salt['pillar.get']('elasticsearch:server'), base='default') %}
diff --git a/elasticsearch/meta/fluentd.yml b/elasticsearch/meta/fluentd.yml
index 29d9914..17848d0 100644
--- a/elasticsearch/meta/fluentd.yml
+++ b/elasticsearch/meta/fluentd.yml
@@ -1,45 +1,48 @@
-config:
-  label:
-    elasticsearch:
-      input:
-        tail_elasticsearch:
-          type: tail
-          tag: elasticsearch.general
-          path: /var/log/elasticsearch/elasticsearch.log
-          pos_file: /tmp/elasticsearch.general.pos
-          format: '/^\[(?<time>[^ ]* [^ ]*)\]\[(?<severity_label>[^ ]*) *?\]\[([^ ]*) *\] \[([^\]]*) *\] (?<Payload>.+)/'
-        tail_elasticsearch_deprecation:
-          type: tail
-          tag: elasticsearch.deprecation
-          path: /var/log/elasticsearch/elasticsearch_deprecation.log
-          pos_file: /tmp/elasticsearch.deprecation.pos
-          format: '/^\[(?<time>[^ ]* [^ ]*)\]\[(?<severity_label>[^ ]*) *?\]\[([^ ]*) *\] (?<Payload>.+)/'
-        tail_elasticsearch_index_indexing_slowlog:
-          type: tail
-          tag: elasticsearch.slowlog.indexing
-          path: /var/log/elasticsearch/elasticsearch_index_indexing_slowlog.log
-          pos_file: /tmp/elasticsearch.slowlog.indexing.pos
-          format: '/^\[(?<time>[^ ]* [^ ]*)\]\[(?<severity_label>[^ ]*) *?\]\[([^ ]*) *\] (?<Payload>.+)/'
-        tail_elasticsearch_index_search_slowlog:
-          type: tail
-          tag: elasticsearch.slowlog.search
-          path: /var/log/elasticsearch/elasticsearch_index_search_slowlog.log
-          pos_file: /tmp/elasticsearch.slowlog.search.pos
-          format: '/^\[(?<time>[^ ]* [^ ]*)\]\[(?<severity_label>[^ ]*) *?\]\[([^ ]*) *\] (?<Payload>.+)/'
-      filter:
-        match_severity:
-          type: record_transformer
-          tag: elasticsearch.**
-          enable_ruby: true
-          record:
-            - name: programname
-              value: elasticsearch
-            - name: Severity
-              value: ${ {"WARN"=>4,"INFO"=>6,"DEBUG"=>7,"TRACE"=>7}[record["severity_label"]] }
-            - name: severity_label
-              value: ${ {"WARN"=>"WARNING","INFO"=>"INFO","DEBUG"=>"DEBUG","TRACE"=>"TRACE"}[record["severity_label"]] }
-      match:
-        push_to_default:
-          tag: elasticsearch.**
-          type: relabel
-          label: default_output
+{%- if pillar.get('fluentd', {}).get('agent') %}
+agent:
+  config:
+    label:
+      elasticsearch:
+        input:
+          tail_elasticsearch:
+            type: tail
+            tag: elasticsearch.general
+            path: /var/log/elasticsearch/elasticsearch.log
+            pos_file: {{ pillar.fluentd.agent.dir.positiondb }}/elasticsearch.general.pos
+            format: '/^\[(?<time>[^ ]* [^ ]*)\]\[(?<severity_label>[^ ]*) *?\]\[([^ ]*) *\] \[([^\]]*) *\] (?<Payload>.+)/'
+          tail_elasticsearch_deprecation:
+            type: tail
+            tag: elasticsearch.deprecation
+            path: /var/log/elasticsearch/elasticsearch_deprecation.log
+            pos_file: {{ pillar.fluentd.agent.dir.positiondb }}/elasticsearch.deprecation.pos
+            format: '/^\[(?<time>[^ ]* [^ ]*)\]\[(?<severity_label>[^ ]*) *?\]\[([^ ]*) *\] (?<Payload>.+)/'
+          tail_elasticsearch_index_indexing_slowlog:
+            type: tail
+            tag: elasticsearch.slowlog.indexing
+            path: /var/log/elasticsearch/elasticsearch_index_indexing_slowlog.log
+            pos_file: {{ pillar.fluentd.agent.dir.positiondb }}/elasticsearch.slowlog.indexing.pos
+            format: '/^\[(?<time>[^ ]* [^ ]*)\]\[(?<severity_label>[^ ]*) *?\]\[([^ ]*) *\] (?<Payload>.+)/'
+          tail_elasticsearch_index_search_slowlog:
+            type: tail
+            tag: elasticsearch.slowlog.search
+            path: /var/log/elasticsearch/elasticsearch_index_search_slowlog.log
+            pos_file: {{ pillar.fluentd.agent.dir.positiondb }}/elasticsearch.slowlog.search.pos
+            format: '/^\[(?<time>[^ ]* [^ ]*)\]\[(?<severity_label>[^ ]*) *?\]\[([^ ]*) *\] (?<Payload>.+)/'
+        filter:
+          match_severity:
+            type: record_transformer
+            tag: elasticsearch.**
+            enable_ruby: true
+            record:
+              - name: programname
+                value: elasticsearch
+              - name: Severity
+                value: ${ {"WARN"=>4,"INFO"=>6,"DEBUG"=>7,"TRACE"=>7}[record["severity_label"]] }
+              - name: severity_label
+                value: ${ {"WARN"=>"WARNING","INFO"=>"INFO","DEBUG"=>"DEBUG","TRACE"=>"TRACE"}[record["severity_label"]] }
+        match:
+          push_to_default:
+            tag: elasticsearch.**
+            type: relabel
+            label: default_output
+{%- endif %}
diff --git a/metadata/service/client.yml b/metadata/service/client.yml
index 203c763..72efe86 100644
--- a/metadata/service/client.yml
+++ b/metadata/service/client.yml
@@ -2,7 +2,7 @@
 - elasticsearch
 parameters:
   _param:
-    elasticsearch_version: 2
+    elasticsearch_version: 5
   elasticsearch:
     client:
       enabled: true
diff --git a/metadata/service/server/cluster.yml b/metadata/service/server/cluster.yml
index 2ff8db5..1f9e961 100644
--- a/metadata/service/server/cluster.yml
+++ b/metadata/service/server/cluster.yml
@@ -4,7 +4,7 @@
 - service.elasticsearch.support
 parameters:
   _param:
-    elasticsearch_version: 2
+    elasticsearch_version: 5
   elasticsearch:
     server:
       enabled: true
diff --git a/metadata/service/server/local.yml b/metadata/service/server/local.yml
index 24f577e..7980251 100644
--- a/metadata/service/server/local.yml
+++ b/metadata/service/server/local.yml
@@ -4,7 +4,7 @@
 - service.elasticsearch.support
 parameters:
   _param:
-    elasticsearch_version: 2
+    elasticsearch_version: 5
   elasticsearch:
     server:
       enabled: true
diff --git a/metadata/service/server/single.yml b/metadata/service/server/single.yml
index 397a0b6..01e7436 100644
--- a/metadata/service/server/single.yml
+++ b/metadata/service/server/single.yml
@@ -4,7 +4,7 @@
 - service.elasticsearch.support
 parameters:
   _param:
-    elasticsearch_version: 2
+    elasticsearch_version: 5
   elasticsearch:
     server:
       enabled: true
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 29fb975..4ee4e0f 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -124,7 +124,7 @@
 }
 
 salt_run() {
-    [ -e ${VEN_DIR}/bin/activate ] && source ${VENV_DIR}/bin/activate
+    [ -e ${VENV_DIR}/bin/activate ] && source ${VENV_DIR}/bin/activate
     salt-call ${SALT_OPTS} $*
 }