Add support for using custom Logstash patterns

A user may want to define and use Logstash patterns. This
commit adds support to copy them into the Monasca Log
Transformer container. In the future support could be
added for other Logstash containers.

Change-Id: Id8cde14af6dc7f49714f6b1cb878882d0048d293
This commit is contained in:
Doug Szumski 2019-04-23 15:46:00 +01:00
parent 3731da0b79
commit 65b9756127
2 changed files with 42 additions and 0 deletions

View File

@ -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'] }}"

View File

@ -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": [