diff --git a/ansible/roles/monasca/tasks/config.yml b/ansible/roles/monasca/tasks/config.yml index e047089060..f3c617c335 100644 --- a/ansible/roles/monasca/tasks/config.yml +++ b/ansible/roles/monasca/tasks/config.yml @@ -208,6 +208,41 @@ notify: - Restart monasca-log-transformer container +- name: Ensuring logstash patterns folder exists + vars: + service: "{{ monasca_services['monasca-log-transformer'] }}" + file: + path: "{{ node_config_directory }}/monasca-log-transformer/logstash_patterns" + state: "directory" + mode: "0770" + become: true + when: + - inventory_hostname in groups[service['group']] + - service.enabled | bool + +- name: Find custom logstash patterns + local_action: + module: find + path: "{{ node_custom_config }}/monasca/logstash_patterns" + pattern: "*" + run_once: True + register: monasca_custom_logstash_patterns + +- name: Copying over custom logstash patterns + vars: + service: "{{ monasca_services['monasca-log-transformer'] }}" + template: + src: "{{ item.path }}" + dest: "{{ node_config_directory }}/monasca-log-transformer/logstash_patterns/{{ item.path | basename }}" + mode: "0660" + with_items: "{{ monasca_custom_logstash_patterns.files }}" + become: true + when: + - inventory_hostname in groups[service['group']] + - service.enabled | bool + notify: + - Restart monasca-log-transformer container + - name: Copying over monasca-log-persister config vars: service: "{{ monasca_services['monasca-log-persister'] }}" diff --git a/ansible/roles/monasca/templates/monasca-log-transformer/monasca-log-transformer.json.j2 b/ansible/roles/monasca/templates/monasca-log-transformer/monasca-log-transformer.json.j2 index 109326485c..733eeedad9 100644 --- a/ansible/roles/monasca/templates/monasca-log-transformer/monasca-log-transformer.json.j2 +++ b/ansible/roles/monasca/templates/monasca-log-transformer/monasca-log-transformer.json.j2 @@ -6,6 +6,13 @@ "dest": "/etc/logstash/conf.d/log-transformer.conf", "owner": "logstash", "perm": "0600" + }, + { + "source": "{{ container_config_directory }}/logstash_patterns/*", + "dest": "/etc/logstash/conf.d/patterns/", + "owner": "logstash", + "perm": "0600", + "optional": true } ], "permissions": [