From 891433cebbf9345af1a8374f59e873dfae40c753 Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Mon, 20 Aug 2018 13:00:12 +0200 Subject: [PATCH] Update index setup --- files/ansible.json | 285 +++++++++++++++++------------------- files/haproxy.json | 353 ++++++++++++++++++++++++++++++++++----------- files/uptime.json | 141 +++++++++--------- tasks/index.yml | 11 +- tasks/main.yml | 1 - 5 files changed, 487 insertions(+), 304 deletions(-) diff --git a/files/ansible.json b/files/ansible.json index dee102b..0532e9c 100644 --- a/files/ansible.json +++ b/files/ansible.json @@ -1,153 +1,140 @@ { - "mapping": { - "ansible": { - "_all": { - "enabled": true - }, - "properties": { - "@log_name": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "@timestamp": { - "type": "date" - }, - "ansible_company": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "ansible_host": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "ansible_playbook": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "ansible_result": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "ansible_task": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "ansible_type": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "fluent_added_timestamp": { - "type": "date" - }, - "host": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "hostname": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "index": { - "type": "long" - }, - "msg": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "session": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "status": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "sys_host": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "sys_module": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "sys_name": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } + "properties": { + "@log_name": { + "type": "text" + }, + "@timestamp": { + "type": "date" + }, + "ansible_company": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "ansible_host": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "ansible_playbook": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "ansible_result": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "ansible_task": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "ansible_type": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "fluent_added_timestamp": { + "type": "date" + }, + "host": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "hostname": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "index": { + "type": "long" + }, + "msg": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "session": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "status": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "sys_host": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "sys_module": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "sys_name": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 } } } diff --git a/files/haproxy.json b/files/haproxy.json index e3a6a3d..4b784a2 100644 --- a/files/haproxy.json +++ b/files/haproxy.json @@ -1,91 +1,270 @@ { - "mapping": { - "haproxy": { - "_all": { - "enabled": true - }, - "properties": { - "actconn": { - "type": "text" - }, - "b_end": { - "type": "text" - }, - "b_server": { - "type": "text" - }, - "backend_queue": { - "type": "text" - }, - "beconn": { - "type": "text" - }, - "bytes_read": { - "type": "text" - }, - "c_ip": { - "type": "text" - }, - "c_port": { - "type": "text" - }, - "captured_request_cookie": { - "type": "text" - }, - "captured_response_cookie": { - "type": "text" - }, - "f_end": { - "type": "text" - }, - "feconn": { - "type": "text" - }, - "http_request": { - "type": "text" - }, - "pid": { - "type": "text" - }, - "prefix": { - "type": "text" - }, - "ps": { - "type": "text" - }, - "retries": { - "type": "text" - }, - "srv_conn": { - "type": "text" - }, - "srv_queue": { - "type": "text" - }, - "status_code": { - "type": "text" - }, - "syslog_time": { - "type": "date", - "format": "dd/MMM/yyyy:HH:mm:ss Z" - }, - "tc": { - "type": "text" - }, - "termination_state": { - "type": "text" - }, - "tq": { - "type": "text" - }, - "tr": { - "type": "text" - }, - "tt": { - "type": "text" - }, - "tw": { - "type": "text" + "properties": { + "@log_name": { + "type": "text" + }, + "actconn": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "b_end": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "b_server": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "backend_queue": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "beconn": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "bytes_read": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "c_ip": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "c_port": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "captured_request_cookie": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "captured_response_cookie": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "f_end": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "feconn": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "hostname": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "http_request": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "message": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "pid": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "prefix": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "ps": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "retries": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "sni": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "srv_conn": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "srv_queue": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "status_code": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "syslog_time": { + "type": "date", + "format": "dd/MMM/yyyy:HH:mm:ss Z" + }, + "tc": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "termination_state": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "tq": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "tr": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "tt": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "tw": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 } } } diff --git a/files/uptime.json b/files/uptime.json index 31cb6c9..fe3ea0a 100644 --- a/files/uptime.json +++ b/files/uptime.json @@ -1,69 +1,80 @@ { - "mapping": { - "ping": { - "_all": { - "enabled": true - }, - "properties": { - "@log_name": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "@timestamp": { - "type": "date" - }, - "downtime": { - "type": "integer" - }, - "error": { - "type": "text" - }, - "fluent_added_timestamp": { - "type": "date" - }, - "hostname": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "isResponsive": { - "type": "boolean" - }, - "isUp": { - "type": "boolean" - }, - "monitorName": { - "type": "text" - }, - "name": { - "type": "text" - }, - "responseTime": { - "type": "integer" - }, - "tag": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tags": { - "type": "text" - }, - "url": { - "type": "text" + "properties": { + "@log_name": { + "type": "text" + }, + "@timestamp": { + "type": "date" + }, + "downtime": { + "type": "integer" + }, + "error": { + "type": "text" + }, + "fluent_added_timestamp": { + "type": "date" + }, + "hostname": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "isResponsive": { + "type": "boolean" + }, + "isUp": { + "type": "boolean" + }, + "monitorName": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "name": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "responseTime": { + "type": "integer" + }, + "tag": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "tags": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "url": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 } } } diff --git a/tasks/index.yml b/tasks/index.yml index cc0343b..283b850 100644 --- a/tasks/index.yml +++ b/tasks/index.yml @@ -10,10 +10,17 @@ - name: "Create Index" uri: - url: 'http://localhost:9200/{{ index }}/' + url: 'http://localhost:9200/{{ index }}' + method: 'PUT' + status_code: 200 + when: es_index.status != 200 + failed_when: false + +- name: "Update Mapping" + uri: + url: 'http://localhost:9200/{{ index }}/_mapping/{{ index }}' method: 'PUT' body: '{{ lookup("file", "{{ index }}.json") }}' status_code: 200 body_format: 'json' - when: es_index.status != 200 failed_when: false diff --git a/tasks/main.yml b/tasks/main.yml index 1ad5315..6621fb4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -16,7 +16,6 @@ - 'uptime' loop_control: loop_var: index - when: false - import_tasks: purge.yml -- GitLab