Support customising Fluentd formatting

In some scenarios it may be useful to perform custom formatting of logs
before forwarding them. For example, the JSON formatter plugin can be
used to convert an event to JSON.

Change-Id: I3dd9240c5910a9477456283b392edc9566882dcd
This commit is contained in:
Doug Szumski 2019-03-07 10:01:30 +00:00
parent d46635598d
commit c8a22f1090
5 changed files with 47 additions and 8 deletions

View File

@ -23,6 +23,7 @@
or fluentd_output.changed | bool or fluentd_output.changed | bool
or fluentd_output_custom.changed | bool or fluentd_output_custom.changed | bool
or fluentd_format.changed | bool or fluentd_format.changed | bool
or fluentd_format_custom.changed | bool
or fluentd_filter.changed | bool or fluentd_filter.changed | bool
or fluentd_filter_custom.changed | bool or fluentd_filter_custom.changed | bool
or fluentd_td_agent.changed | bool or fluentd_td_agent.changed | bool

View File

@ -158,6 +158,27 @@
notify: notify:
- Restart fluentd container - Restart fluentd container
- name: Find custom fluentd format config files
local_action:
module: find
path: "{{ node_custom_config }}/fluentd/format"
pattern: "*.conf"
run_once: True
register: find_custom_fluentd_format
when:
- enable_fluentd | bool
- name: Copying over custom fluentd format config files
template:
src: "{{ item.path }}"
dest: "{{ node_config_directory }}/fluentd/format/{{ item.path | basename }}"
register: fluentd_format_custom
when:
- enable_fluentd | bool
with_items: "{{ find_custom_fluentd_format.files }}"
notify:
- Restart fluentd container
- name: Copying over fluentd filter config files - name: Copying over fluentd filter config files
template: template:
src: "conf/filter/{{ item.src }}.conf.j2" src: "conf/filter/{{ item.src }}.conf.j2"

View File

@ -27,15 +27,11 @@
"owner": "{{ fluentd_user }}", "owner": "{{ fluentd_user }}",
"perm": "0600" "perm": "0600"
}, },
{# Copy all configuration files in format/ directory to include #}
{# custom format configs. #}
{ {
"source": "{{ container_config_directory }}/format/apache_access.conf", "source": "{{ container_config_directory }}/format/*.conf",
"dest": "{{ fluentd_dir }}/format/apache_access.conf", "dest": "{{ fluentd_dir }}/format/",
"owner": "{{ fluentd_user }}",
"perm": "0600"
},
{
"source": "{{ container_config_directory }}/format/wsgi_access.conf",
"dest": "{{ fluentd_dir }}/format/wsgi_access.conf",
"owner": "{{ fluentd_user }}", "owner": "{{ fluentd_user }}",
"perm": "0600" "perm": "0600"
}, },

View File

@ -182,6 +182,17 @@ Configuration of custom fluentd filters is possible by placing filter
configuration files in ``/etc/kolla/config/fluentd/filter/*.conf`` on the configuration files in ``/etc/kolla/config/fluentd/filter/*.conf`` on the
control host. control host.
Custom log formatting
---------------------
In some scenarios it may be useful to perform custom formatting of logs before
forwarding them. For example, the JSON formatter plugin can be used to convert
an event to JSON.
Configuration of custom fluentd formatting is possible by placing filter
configuration files in ``/etc/kolla/config/fluentd/format/*.conf`` on the
control host.
Custom log forwarding Custom log forwarding
--------------------- ---------------------

View File

@ -0,0 +1,10 @@
---
features:
- |
Adds ability to configure custom fluentd formatting.
In some scenarios it may be useful to configure custom fluentd formatting
to, for example, convert events to JSON.
Configuration of custom fluentd formatting is possible by placing
output configuration files in /etc/kolla/config/fluentd/format/\*.conf.