68664a9dc1
Updated ELK config files to elk 7.x reference samples, bringing over existing customisation from elk_metrics_6x. Removed deprecated use of --pipeline in elastic_beat_setup/tasks/main.yml, --pipeline is no longer a valid cli argument. Updated logstash-pipelines and removed the dynamic insertion of the date into index names. This function is now done with the new ILM feature in elasticsearch rather than logstash. Installation of each beat creates an ILM policy for that beat and this patch does not change the default policy. It is possible that the default policy will exhaust the available storage and future work needs to be done to address this. The non-beat elements of the logstash pipeline (syslog, collectd and others) are not yet updated to be compatible with ILM. Change-Id: I735b64c2b7b93e23562f35266134a176a00af1b7
92 lines
3.1 KiB
YAML
92 lines
3.1 KiB
YAML
---
|
|
# Copyright 2018, Rackspace US, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
- name: Get rollup job
|
|
uri:
|
|
url: "http://{{ coordination_nodes[0] }}/_xpack/rollup/job/rollup_{{ index_name }}"
|
|
method: GET
|
|
register: check_rollup
|
|
environment:
|
|
no_proxy: "{{ coordination_nodes[0].split(':')[0] }}"
|
|
until: check_rollup is success
|
|
retries: 3
|
|
delay: 5
|
|
run_once: true
|
|
|
|
- name: Check for existing rollup job
|
|
debug:
|
|
msg: >-
|
|
An existing rollup job was found for {{ index_name }}. In order to
|
|
re-create this rollup job the old job will need to be purged. If you're
|
|
OK with the old rollup job being purged, add the following option
|
|
`elastic_allow_rollup_purge=yes` to the command line and rerun the
|
|
playbook.
|
|
run_once: true
|
|
when:
|
|
- check_rollup['json']['jobs'] | length > 0
|
|
- not elastic_allow_rollup_purge | bool
|
|
|
|
- name: Create rollup block
|
|
block:
|
|
- name: Create rollup job
|
|
uri:
|
|
url: "{{ item.url }}"
|
|
method: "{{ item.method }}"
|
|
body: "{{ item.index_options | to_json }}"
|
|
status_code: "{{ item.status_code }}"
|
|
body_format: json
|
|
register: elk_indexes
|
|
environment:
|
|
no_proxy: "{{ coordination_nodes[0].split(':')[0] }}"
|
|
until: elk_indexes is success
|
|
retries: 5
|
|
delay: 5
|
|
when:
|
|
- (days_until_rollup | int) > 0
|
|
with_items:
|
|
- url: "http://{{ coordination_nodes[0] }}/_xpack/rollup/job/rollup_{{ index_name }}/_stop"
|
|
method: POST
|
|
status_code: 200,404
|
|
index_options: {}
|
|
- url: "http://{{ coordination_nodes[0] }}/_xpack/rollup/job/rollup_{{ index_name }}"
|
|
method: DELETE
|
|
status_code: 200,404
|
|
index_options: {}
|
|
- url: "http://{{ coordination_nodes[0] }}/rollup_{{ index_name }}"
|
|
method: DELETE
|
|
status_code: 200,404
|
|
index_options: {}
|
|
- url: "http://{{ coordination_nodes[0] }}/_xpack/rollup/job/rollup_{{ index_name }}"
|
|
method: PUT
|
|
status_code: 200,400
|
|
index_options:
|
|
index_pattern: "{{ index_name }}-*"
|
|
rollup_index: "rollup_{{ index_name }}"
|
|
cron: "*/30 * * * * ?"
|
|
page_size: 1000
|
|
groups:
|
|
date_histogram:
|
|
field: "@timestamp"
|
|
interval: "1h"
|
|
delay: "{{ days_until_rollup }}d"
|
|
- url: "http://{{ coordination_nodes[0] }}/_xpack/rollup/job/rollup_{{ index_name }}/_start"
|
|
method: POST
|
|
status_code: 200,404
|
|
index_options: {}
|
|
run_once: true
|
|
when:
|
|
- check_rollup['json']['jobs'] | length < 1 or
|
|
elastic_allow_rollup_purge | bool
|