Enable the Fluentd Plugin Systemd

Adds configurations and changes tasks to enable the
systemd plugin. Additionaly, the plugin is set to
read logs from the /var/log/journal directory

Implements: enable-fluent-plugin-systemd
Signed-off-by: Juan Pablo Suazo <jsuazo@whitestack.com>
Change-Id: Ic714a341befa5f906d9c0f78fa86f4c934df87cd
This commit is contained in:
Juan Pablo Suazo 2023-03-01 16:55:13 -03:00
parent 68ef87f844
commit 31826809e8
8 changed files with 54 additions and 0 deletions

View File

@ -803,6 +803,7 @@ enable_cyborg: "no"
enable_designate: "no"
enable_etcd: "no"
enable_fluentd: "yes"
enable_fluentd_systemd: "{{ (enable_fluentd | bool) and (enable_central_logging | bool) }}"
enable_freezer: "no"
enable_gnocchi: "no"
enable_gnocchi_statsd: "no"

View File

@ -120,6 +120,7 @@ fluentd_default_volumes:
- "{{ '/etc/timezone:/etc/timezone:ro' if ansible_facts.os_family == 'Debian' else '' }}"
- "kolla_logs:/var/log/kolla/"
- "fluentd_data:/var/lib/fluentd/data/"
- "/var/log/journal:/var/log/journal:ro"
kolla_toolbox_extra_volumes: "{{ default_extra_volumes }}"
cron_extra_volumes: "{{ default_extra_volumes }}"
fluentd_extra_volumes: "{{ default_extra_volumes }}"

View File

@ -114,6 +114,8 @@
enabled: true
- name: "conf/input/11-letsencrypt.conf.j2"
enabled: "{{ enable_letsencrypt | bool }}"
- name: "conf/input/12-systemd.conf.j2"
enabled: "{{ enable_fluentd_systemd | bool }}"
customised_input_files: "{{ find_custom_fluentd_inputs.files | map(attribute='path') | list }}"
# Filters
fluentd_filter_files: "{{ default_filter_files | customise_fluentd(customised_filter_files) }}"

View File

@ -0,0 +1,9 @@
<source>
@type systemd
tag journal
path /var/log/journal
<entry>
fields_strip_underscores true
fields_lowercase true
</entry>
</source>

View File

@ -26,6 +26,13 @@
"recurse": true
},
{% endfor %}
{% if enable_fluentd_systemd | bool %}
{
"path": "/var/log/journal",
"owner": "{{ fluentd_user }}:{{ fluentd_user }}",
"recurse": true
},
{% endif %}
{
"path": "/var/lib/fluentd/data",
"owner": "{{ fluentd_user }}:{{ fluentd_user }}",

View File

@ -232,3 +232,13 @@ network equipment. This can be done by configuring custom fluentd inputs.
Configuration of custom fluentd inputs is possible by placing input
configuration files in ``/etc/kolla/config/fluentd/input/*.conf`` on the
control host.
Systemd Logs
------------
By default, when enabling central logging, we also enable reading ``systemd``
logs from the ``/var/log/journal`` file.
To disable this behavior when central logging is enabled, set the value of
the variable ``enable_fluentd_systemd`` to ``false`` in the configuration
file ``/etc/kolla/globals.yml``.

View File

@ -345,6 +345,7 @@ workaround_ansible_issue_8743: yes
#enable_destroy_images: "no"
#enable_etcd: "no"
#enable_fluentd: "yes"
#enable_fluentd_systemd: "{{ (enable_fluentd | bool) and (enable_central_logging | bool) }}"
#enable_freezer: "no"
#enable_gnocchi: "no"
#enable_gnocchi_statsd: "no"

View File

@ -0,0 +1,23 @@
---
features:
- |
Implements [Enable Fluentd Plugin Systemd].
Adds the needed changes and configurations in order to use the
fluentd plugin, systemd, to read logs from /var/log/journal by
default. This allows us to read and manipulate this logs for
monitoring purposes.
These logs will be sent to OpenSearch by default, to disable this
behavior, set the value of the variable ``enable_fluentd_systemd``
to ``false`` in the configuration file ``/etc/kolla/globals.yml``.
By default, when enabling central logging, we also enable the
``systemd`` plugin. To disable this behavior when central logging
is enabled, set the value of the variable ``enable_fluentd_systemd``
to ``false`` in the configuration file ``/etc/kolla/globals.yml``.
fluent-plugin-systemd source:
https://github.com/fluent-plugin-systemd/fluent-plugin-systemd
`Blueprint enable-fluent-plugin-systemd
<https://blueprints.launchpad.net/kolla-ansible/+spec/enable-fluent-plugin-systemd>`__