add ilm policies to handle the life of the es indices
two policies are added to handle short and long term indices. life of the indices can be configured using the 'elasticsearch.life' field at browbeat-config.yml file shortterm will have: 125 days longterm will have 2 years the policy and the policy based templates can be created using the 'es-template' install playbook. Change-Id: I0f4a4a9acc03092fd582ae4ff50f688850def953
This commit is contained in:
parent
99512c928e
commit
96452a643a
|
@ -23,6 +23,17 @@
|
|||
ignore_errors: true
|
||||
when: elastic5
|
||||
|
||||
- name: Upload ilm policy
|
||||
uri:
|
||||
url: http://{{ es_ip }}:{{es_local_port }}/_ilm/policy/{{ item | basename | regex_replace('\.json','') }}
|
||||
method: PUT
|
||||
body: "{{ lookup('file', item) }}"
|
||||
body_format: json
|
||||
with_fileglob:
|
||||
- "{{ browbeat_path }}/elastic/v7ilm_policy/browbeat*"
|
||||
ignore_errors: true
|
||||
when: elastic7
|
||||
|
||||
- name: Upload templates
|
||||
uri:
|
||||
url: http://{{ es_ip }}:{{ es_local_port }}/_template/{{ item | basename | regex_replace('\.json','') }}
|
||||
|
|
|
@ -23,6 +23,7 @@ elasticsearch:
|
|||
enabled: true
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: true
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -37,6 +37,8 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
#allowed values: shortterm, longterm
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -46,10 +46,11 @@ class Elastic(object):
|
|||
'port': self.config['elasticsearch']['port']}],
|
||||
send_get_body_as='POST'
|
||||
)
|
||||
life = self.config['elasticsearch']['life']
|
||||
self.workload = workload
|
||||
today = datetime.datetime.today()
|
||||
self.index = "{}-{}-{}".format(tool, workload,
|
||||
today.strftime('%Y.%m'))
|
||||
self.index = "{}-{}-{}-{}".format(tool, workload, life,
|
||||
today.strftime('%Y.%m'))
|
||||
|
||||
def __del__(self):
|
||||
self.flush_cache()
|
||||
|
|
|
@ -75,6 +75,9 @@ mapping:
|
|||
port:
|
||||
type: int
|
||||
required: True
|
||||
life:
|
||||
type: str
|
||||
required: True
|
||||
regather:
|
||||
type: bool
|
||||
required: True
|
||||
|
|
|
@ -17,6 +17,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -18,6 +18,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -18,6 +18,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -17,6 +17,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -17,6 +17,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -20,6 +20,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -18,6 +18,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -17,6 +17,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -24,6 +24,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -24,6 +24,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -24,6 +24,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -24,6 +24,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -21,6 +21,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -21,6 +21,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -20,6 +20,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -22,6 +22,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -20,6 +20,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -21,6 +21,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: 1.1.1.1
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"policy": {
|
||||
"phases": {
|
||||
"delete": {
|
||||
"min_age": "2y",
|
||||
"actions": {
|
||||
"delete": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"policy": {
|
||||
"phases": {
|
||||
"delete": {
|
||||
"min_age": "125d",
|
||||
"actions": {
|
||||
"delete": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -17,6 +17,7 @@ elasticsearch:
|
|||
enabled: false
|
||||
host: browbeat.test.com
|
||||
port: 9200
|
||||
life: shortterm
|
||||
regather: false
|
||||
metadata_files:
|
||||
- name: hardware-metadata
|
||||
|
|
Loading…
Reference in New Issue