diff --git a/ansible/roles/common/handlers/main.yml b/ansible/roles/common/handlers/main.yml index 8c4965b78b..8f5ef79d95 100644 --- a/ansible/roles/common/handlers/main.yml +++ b/ansible/roles/common/handlers/main.yml @@ -17,6 +17,7 @@ - config_json.changed | bool or fluentd_input.changed | bool or fluentd_output.changed | bool + or fluentd_output_custom.changed | bool or fluentd_format.changed | bool or fluentd_filter.changed | bool or fluentd_td_agent.changed | bool diff --git a/ansible/roles/common/tasks/config.yml b/ansible/roles/common/tasks/config.yml index 62cd12862c..721bc4d753 100644 --- a/ansible/roles/common/tasks/config.yml +++ b/ansible/roles/common/tasks/config.yml @@ -53,6 +53,23 @@ notify: - Restart fluentd container +- name: Find custom fluentd output config files + local_action: + module: find + path: "{{ node_custom_config }}/fluentd/output" + pattern: "*.conf" + run_once: True + register: find_custom_fluentd_outputs + +- name: Copying over custom fluentd output config files + template: + src: "{{ item.path }}" + dest: "{{ node_config_directory }}/fluentd/output/{{ item.path | basename }}" + register: fluentd_output_custom + with_items: "{{ find_custom_fluentd_outputs.files }}" + notify: + - Restart fluentd container + - name: Copying over fluentd format config files template: src: "conf/format/{{ item }}.conf.j2" diff --git a/ansible/roles/common/templates/fluentd.json.j2 b/ansible/roles/common/templates/fluentd.json.j2 index 97c72b69a0..e12daa3129 100644 --- a/ansible/roles/common/templates/fluentd.json.j2 +++ b/ansible/roles/common/templates/fluentd.json.j2 @@ -70,17 +70,12 @@ "dest": "{{ fluentd_dir }}/format/wsgi_access.conf", "owner": "{{ fluentd_user }}", "perm": "0600" - },{% if enable_elasticsearch | bool or - ( elasticsearch_address != kolla_internal_vip_address ) | bool %} + }, + {# Copy all configuration files in output/ directory to include #} + {# custom output configs. #} { - "source": "{{ container_config_directory }}/output/01-es.conf", - "dest": "{{ fluentd_dir }}/output/01-es.conf", - "owner": "{{ fluentd_user }}", - "perm": "0600" - },{% endif %} - { - "source": "{{ container_config_directory }}/output/00-local.conf", - "dest": "{{ fluentd_dir }}/output/00-local.conf", + "source": "{{ container_config_directory }}/output/*.conf", + "dest": "{{ fluentd_dir }}/output/", "owner": "{{ fluentd_user }}", "perm": "0600" } diff --git a/doc/source/reference/central-logging-guide.rst b/doc/source/reference/central-logging-guide.rst index 938b8b1374..25e39eeee8 100644 --- a/doc/source/reference/central-logging-guide.rst +++ b/doc/source/reference/central-logging-guide.rst @@ -154,3 +154,13 @@ item can be exported separately by selecting it in the menu. All of the items can also be exported at once by choosing *export everything* option. In the same tab (Settings - Objects) one can also import saved items by choosing *import* option. + +Custom log forwarding +===================== + +In some scenarios it may be useful to forward logs to a logging service other +than elasticsearch. This can be done by configuring custom fluentd outputs. + +Configuration of custom fluentd outputs is possible by placing output +configuration files in ``/etc/kolla/config/fluentd/output/*.conf`` on the +control host. diff --git a/releasenotes/notes/fluentd-custom-output-config-21f990cacbf3adb1.yaml b/releasenotes/notes/fluentd-custom-output-config-21f990cacbf3adb1.yaml new file mode 100644 index 0000000000..569809f671 --- /dev/null +++ b/releasenotes/notes/fluentd-custom-output-config-21f990cacbf3adb1.yaml @@ -0,0 +1,10 @@ +--- +features: + - | + Adds ability to configure custom fluentd outputs. + + In some scenarios it may be useful to configure custom fluentd outputs + to forward logs to a logging service other than elasticsearch. + + Configuration of custom fluentd outputs is possible by placing + output configuration files in /etc/kolla/config/fluentd/output/\*.conf.