Skip to content

Commit 1235fa9

Browse files
committed
Support bypassing Monasca Log API for control plane logs
This change allows a user to forward control plane logs directly to Elasticsearch from Fluentd, rather than via the Monasca Log API when Monasca is enabled. The Monasca Log API can continue to handle tenant logs. For many use cases this is simpler, reduces resource consumption and helps to decouple control plane logging services from tenant logging services. It may not always be desired, so is optional and off by default. Change-Id: I195e8e4b73ca8f573737355908eb30a3ef13b0d6
1 parent 5284805 commit 1235fa9

File tree

7 files changed

+45
-8
lines changed

7 files changed

+45
-8
lines changed

ansible/group_vars/all.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,11 @@ enable_destroy_images: "no"
720720
####################
721721
monasca_enable_alerting_pipeline: True
722722

723+
# Send logs from the control plane to the Monasca API. Monasca will then persist
724+
# them in Elasticsearch. If this is disabled, control plane logs will be sent
725+
# directly to Elasticsearch.
726+
monasca_ingest_control_plane_logs: True
727+
723728
monasca_api_admin_base_endpoint: "{{ admin_protocol }}://{{ kolla_internal_fqdn | put_address_in_context('url') }}:{{ monasca_api_port }}"
724729
monasca_api_internal_base_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn | put_address_in_context('url') }}:{{ monasca_api_port }}"
725730
monasca_api_public_base_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn | put_address_in_context('url') }}:{{ monasca_api_port }}"

ansible/roles/common/tasks/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
log_direct_to_elasticsearch: >-
107107
{{ ( enable_elasticsearch | bool or
108108
( elasticsearch_address != kolla_internal_vip_address )) and
109-
not enable_monasca | bool }}
109+
( not enable_monasca | bool or not monasca_ingest_control_plane_logs | bool ) }}
110110
fluentd_version: "{{ fluentd_labels.images.0.ContainerConfig.Labels.fluentd_version | default('0.12') }}"
111111
# Inputs
112112
fluentd_input_files: "{{ default_input_files | customise_fluentd(customised_input_files) }}"
@@ -143,7 +143,7 @@
143143
- name: "conf/output/01-es.conf.j2"
144144
enabled: "{{ log_direct_to_elasticsearch }}"
145145
- name: "conf/output/02-monasca.conf.j2"
146-
enabled: "{{ enable_monasca | bool }}"
146+
enabled: "{{ enable_monasca | bool and monasca_ingest_control_plane_logs | bool }}"
147147
customised_output_files: "{{ find_custom_fluentd_outputs.files | map(attribute='path') | list }}"
148148
template:
149149
src: "td-agent.conf.j2"

ansible/roles/common/templates/conf/filter/00-record_transformer.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
</record>
7272
</filter>
7373

74-
{% if enable_monasca | bool %}
74+
{% if enable_monasca | bool and monasca_ingest_control_plane_logs | bool %}
7575
# Kolla configures Fluentd to extract timestamps from OpenStack service
7676
# logs, however these timestamps are not saved in the event and are not
7777
# forwarded to Monasca. Here we save the timestamp which has been

ansible/roles/common/templates/conf/output/00-local.conf.j2

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
buffer_type file
3737
buffer_path /var/lib/fluentd/data/elasticsearch.buffer/{{ syslog_swift_facility }}.*
3838
</store>
39-
{% elif enable_monasca | bool %}
39+
{% elif enable_monasca | bool and monasca_ingest_control_plane_logs | bool %}
4040
<store>
4141
@type monasca
4242
keystone_url {{ keystone_internal_url }}
@@ -98,7 +98,7 @@
9898
buffer_type file
9999
buffer_path /var/lib/fluentd/data/elasticsearch.buffer/{{ syslog_haproxy_facility }}.*
100100
</store>
101-
{% elif enable_monasca | bool %}
101+
{% elif enable_monasca | bool and monasca_ingest_control_plane_logs | bool %}
102102
<store>
103103
@type monasca
104104
keystone_url {{ keystone_internal_url }}
@@ -158,7 +158,7 @@
158158
buffer_type file
159159
buffer_path /var/lib/fluentd/data/elasticsearch.buffer/{{ syslog_glance_tls_proxy_facility }}.*
160160
</store>
161-
{% elif enable_monasca | bool %}
161+
{% elif enable_monasca | bool and monasca_ingest_control_plane_logs | bool %}
162162
<store>
163163
@type monasca
164164
keystone_url {{ keystone_internal_url }}
@@ -219,7 +219,7 @@
219219
buffer_type file
220220
buffer_path /var/lib/fluentd/data/elasticsearch.buffer/{{ syslog_neutron_tls_proxy_facility }}.*
221221
</store>
222-
{% elif enable_monasca | bool %}
222+
{% elif enable_monasca | bool and monasca_ingest_control_plane_logs | bool %}
223223
<store>
224224
@type monasca
225225
keystone_url {{ keystone_internal_url }}

ansible/roles/elasticsearch/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ elasticsearch_curator_dry_run: false
5959

6060
# Index prefix pattern. Any indices matching this regex will
6161
# be managed by Curator.
62-
elasticsearch_curator_index_pattern: "^{{ 'monasca' if enable_monasca|bool else kibana_log_prefix }}-.*"
62+
elasticsearch_curator_index_pattern: "^{{ '(monasca|' + kibana_log_prefix + ')' if enable_monasca|bool else kibana_log_prefix }}-.*"
6363

6464
# Duration after which an index is staged for deletion. This is
6565
# implemented by closing the index. Whilst in this state the index

doc/source/reference/logging-and-monitoring/monasca-guide.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,33 @@ resource usage you can set ``/etc/kolla/globals.yml``:
4545
4646
monasca_enable_alerting_pipeline: "no"
4747
48+
You can optionally bypass Monasca for control plane logs, and instead have
49+
them sent directly to Elasticsearch. This should be avoided if you have
50+
deployed Monasca as a standalone service for the purpose of storing
51+
logs in a protected silo for security purposes. However, if this is not
52+
a relevant consideration, for example you have deployed Monasca alongside the
53+
existing Openstack control plane, then you may free up some resources by
54+
setting:
55+
56+
.. code-block:: yaml
57+
58+
monasca_ingest_control_plane_logs: "no"
59+
60+
You should note that when making this change with the default
61+
``kibana_log_prefix`` prefix of ``flog-``, you will need to create a new
62+
index pattern in Kibana accordingly. If you wish to continue to search all
63+
logs using the same index pattern in Kibana, then you can override
64+
``kibana_log_prefix`` to ``monasca`` or similar in ``/etc/kolla/globals.yml``:
65+
66+
.. code-block:: yaml
67+
68+
kibana_log_prefix: "monasca"
69+
70+
If you have enabled Elasticsearch Curator, it will be configured to rotate
71+
logs with index patterns matching either ``^flog-.*`` or ``^monasca-.*`` by
72+
default. If this is undesirable then you can update the
73+
``elasticsearch_curator_index_pattern`` variable accordingly.
74+
4875
Currently Monasca is only supported using the ``source`` install type Kolla
4976
images. If you are using the ``binary`` install type you should set the
5077
following override in ``/etc/kolla/globals.yml``:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
features:
3+
- |
4+
Optionally support sending control plane logs directly to
5+
Elasticsearch when Monasca is enabled.

0 commit comments

Comments
 (0)