diff --git a/ansible/roles/core_filebeat/tasks/main.yml b/ansible/roles/core_filebeat/tasks/main.yml index 11cd8d77..001cf43e 100644 --- a/ansible/roles/core_filebeat/tasks/main.yml +++ b/ansible/roles/core_filebeat/tasks/main.yml @@ -26,7 +26,7 @@ name: geerlingguy.filebeat - name: Make sure filebeat is restarted - service: + ansible.builtin.service: name: filebeat state: restarted enabled: true diff --git a/ansible/roles/dashmate/tasks/logs.yml b/ansible/roles/dashmate/tasks/logs.yml index b886c6d2..7025e9b8 100644 --- a/ansible/roles/dashmate/tasks/logs.yml +++ b/ansible/roles/dashmate/tasks/logs.yml @@ -43,7 +43,7 @@ name: geerlingguy.filebeat - name: Make sure filebeat is restarted - service: + ansible.builtin.service: name: filebeat state: restarted enabled: true diff --git a/ansible/roles/dashmate_elastic_beats/tasks/main.yml b/ansible/roles/dashmate_elastic_beats/tasks/main.yml deleted file mode 100644 index 88b4df77..00000000 --- a/ansible/roles/dashmate_elastic_beats/tasks/main.yml +++ /dev/null @@ -1,124 +0,0 @@ ---- - -- name: Get core container host info - community.docker.docker_host_info: - containers: true - containers_filters: - name: '{{ core_container_name }}' - register: core_host_info - -- name: Get tenderdash container host info - community.docker.docker_host_info: - containers: true - containers_filters: - name: tender - register: tenderdash_host_info - -- name: Get drive container host info - community.docker.docker_host_info: - containers: true - containers_filters: - name: abci - register: drive_host_info - -- name: Set container ids for core and tenderdash - ansible.builtin.set_fact: - core_container_id: '{{ core_host_info.containers[0].Id if (core_host_info.containers | length > 0) else "null" }}' - tenderdash_container_id: '{{ tenderdash_host_info.containers[0].Id if (tenderdash_host_info.containers | length > 0) else "null" }}' - -- name: Load common filebeat config - ansible.builtin.include_vars: - file: common.yml - -- name: Load core input config - ansible.builtin.include_vars: - file: core.yml - -- name: Load tenderdash input config - ansible.builtin.include_vars: - file: tenderdash.yml - when: tenderdash_host_info.containers | length > 0 - -- name: Load drive input config - ansible.builtin.include_vars: - file: drive.yml - when: drive_host_info.containers | length > 0 - -- name: Merge drive and tenderdash input configs - ansible.builtin.set_fact: - platform_filebeat_inputs: "{{ [platform_filebeat_inputs, drive_filebeat_inputs] | community.general.lists_mergeby('index') }}" - when: platform_filebeat_inputs is defined and drive_filebeat_inputs is defined - -- name: Merge platform and core input configs - ansible.builtin.set_fact: - filebeat_inputs: "{{ [filebeat_inputs, platform_filebeat_inputs] | community.general.lists_mergeby('index') }}" - when: platform_filebeat_inputs is defined - -- name: Set up filebeat log monitoring - ansible.builtin.include_role: - name: geerlingguy.filebeat - -- name: Make sure Filebeat is restarted - service: - name: filebeat - state: restarted - enabled: true - -# TODO: Make sure we have retention policy for metrics -- name: Set up metricbeat - ansible.builtin.include_role: - name: elastic.beats - vars: - beats_version: "{{ elastic_version }}" - beat: metricbeat - beat_conf: - setup: - dashboards: - enabled: true - kibana: - host: "{{ hostvars['logs-1'].private_ip }}:5601" - username: "{{ elastic_username }}" - password: "{{ elastic_password }}" - metricbeat: - modules: - - module: system - metricsets: - - cpu # CPU usage - - load # CPU load averages - - memory # Memory usage - - network # Network IO - - process # Per process metrics - - process_summary # Process summary - - uptime # System Uptime - - socket_summary # Socket summary - - core # Per CPU core usage - - diskio # Disk IO - - fsstat # File system summary metrics - - socket # Sockets and connection info (linux only) - enabled: true - period: 10s - processes: ['.*'] - - # Configure the metric types that are included by these metricsets. - cpu.metrics: ["percentages", "normalized_percentages"] # The other available option is ticks. - core.metrics: ["percentages"] # The other available option is ticks. - - module: docker - metricsets: - - "container" - - "cpu" - - "diskio" - - "event" - - "healthcheck" - - "info" - - "memory" - - "network" - # - "network_summary" - hosts: ["unix:///var/run/docker.sock"] - period: 10s - enabled: true - output_conf: - elasticsearch: - hosts: - - "{{ hostvars['logs-1'].private_ip }}:9200" - username: "{{ elastic_username }}" - password: "{{ elastic_password }}" diff --git a/ansible/roles/dashmate_elastic_beats/vars/common.yml b/ansible/roles/dashmate_elastic_beats/vars/common.yml deleted file mode 100644 index d2b0f728..00000000 --- a/ansible/roles/dashmate_elastic_beats/vars/common.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- - -filebeat_version: 8.x -filebeat_package: "filebeat={{ elastic_version }}" -filebeat_output_logstash_enabled: false -filebeat_output_elasticsearch_enabled: true -filebeat_output_elasticsearch_hosts: - - "{{ hostvars['logs-1'].private_ip }}:9200" -filebeat_output_elasticsearch_auth: - username: "{{ elastic_username }}" - password: "{{ elastic_password }}" -filebeat_enable_logging: true -filebeat_log_level: info diff --git a/ansible/roles/dashmate_elastic_beats/vars/core.yml b/ansible/roles/dashmate_elastic_beats/vars/core.yml deleted file mode 100644 index ed7e161b..00000000 --- a/ansible/roles/dashmate_elastic_beats/vars/core.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- - -filebeat_inputs: - - type: container - enabled: "{{ core_host_info.containers | length > 0 }}" - index: "logs-core-{{ dash_network_name }}-%{[agent.version]}" - paths: - - '/var/lib/docker/containers/{{ core_container_id }}/*.log' - processors: - - add_fields: - target: event - fields: - dataset: "core-{{ dash_network_name }}" - - dissect: - tokenizer: "%{?timestamp} %{message}" - overwrite_keys: true - target_prefix: "" diff --git a/ansible/roles/dashmate_elastic_beats/vars/drive.yml b/ansible/roles/dashmate_elastic_beats/vars/drive.yml deleted file mode 100644 index 6cc5efc9..00000000 --- a/ansible/roles/dashmate_elastic_beats/vars/drive.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- - -drive_filebeat_inputs: - - type: log - enabled: "{{ drive_host_info.containers | length > 0 }}" - json.message_key: message - exclude_files: ['\.gz$'] - index: "logs-drive.abci-{{ dash_network_name }}-%{[agent.version]}" - paths: - - "{{ abci_logs_path }}/drive-json*.log*" - processors: - - timestamp: - field: json.timestamp - layouts: - - UNIX_MS - - add_fields: - target: event - fields: - dataset: "drive.abci-{{ dash_network_name }}" - - rename: - fields: - - from: "json.fields.message" - to: "message" - - from: "json.level" - to: "log.level" - ignore_missing: true - fail_on_error: true diff --git a/ansible/roles/dashmate_elastic_beats/vars/tenderdash.yml b/ansible/roles/dashmate_elastic_beats/vars/tenderdash.yml deleted file mode 100644 index f958ec10..00000000 --- a/ansible/roles/dashmate_elastic_beats/vars/tenderdash.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- - -platform_filebeat_inputs: - - type: container - enabled: "{{ tenderdash_host_info.containers | length > 0 }}" - json.message_key: message - index: "logs-drive.tenderdash-{{ dash_network_name }}-%{[agent.version]}" - paths: - - '/var/lib/docker/containers/{{ tenderdash_container_id }}/*.log' - processors: - - add_fields: - target: event - fields: - dataset: "drive.tenderdash-{{ dash_network_name }}" - - rename: - fields: - - from: "json.message" - to: "message" - ignore_missing: true - fail_on_error: true - - rename: - fields: - - from: "json.level" - to: "log.level"