Merge "Forward system logs to Monasca Log API"

This commit is contained in:
Zuul 2018-10-30 13:41:31 +00:00 committed by Gerrit Code Review
commit 1731f81fa0
3 changed files with 64 additions and 6 deletions

View File

@ -79,6 +79,12 @@
notify: notify:
- Restart fluentd container - Restart fluentd container
- name: Determine whether logs should be forwarded directly to Elasticsearch
set_fact:
log_direct_to_elasticsearch: "{{ ( enable_elasticsearch | bool or
( elasticsearch_address != kolla_internal_vip_address )) and
not enable_monasca | bool }}"
- name: Copying over fluentd output config files - name: Copying over fluentd output config files
template: template:
src: "conf/output/{{ item.name }}.conf.j2" src: "conf/output/{{ item.name }}.conf.j2"
@ -93,8 +99,25 @@
- name: "00-local" - name: "00-local"
enabled: true enabled: true
- name: "01-es" - name: "01-es"
enabled: "{{ enable_elasticsearch | bool or enabled: "{{ log_direct_to_elasticsearch }}"
( elasticsearch_address != kolla_internal_vip_address ) }}" - name: "02-monasca"
enabled: "{{ enable_monasca | bool }}"
notify:
- Restart fluentd container
- name: Removing stale output config files
file:
path: "{{ node_config_directory }}/fluentd/output/{{ item.name }}.conf"
state: "absent"
become: true
when:
- enable_fluentd | bool
- item.disable | bool
with_items:
- name: "02-monasca"
disable: "{{ not enable_monasca | bool }}"
- name: "01-es"
disable: "{{ not log_direct_to_elasticsearch }}"
notify: notify:
- Restart fluentd container - Restart fluentd container

View File

@ -7,8 +7,7 @@
append true append true
compress gzip compress gzip
</store> </store>
{% if enable_elasticsearch | bool or {% if log_direct_to_elasticsearch %}
elasticsearch_address != kolla_internal_vip_address %}
<store> <store>
type elasticsearch type elasticsearch
host {{ elasticsearch_address }} host {{ elasticsearch_address }}
@ -17,6 +16,18 @@
logstash_prefix {{ kibana_log_prefix }} logstash_prefix {{ kibana_log_prefix }}
flush_interval 15s flush_interval 15s
</store> </store>
{% elif enable_monasca | bool %}
type copy
<store>
@type monasca
keystone_url {{ keystone_internal_url }}
monasca_log_api {{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ monasca_log_api_port }}
monasca_log_api_version v3.0
username {{ monasca_agent_user }}
password {{ monasca_agent_password }}
domain_id default
project_name {{ monasca_control_plane_project }}
</store>
{% endif %} {% endif %}
</match> </match>
@ -31,8 +42,7 @@
append true append true
compress gzip compress gzip
</store> </store>
{% if enable_elasticsearch | bool or {% if log_direct_to_elasticsearch %}
elasticsearch_address != kolla_internal_vip_address %}
<store> <store>
type elasticsearch type elasticsearch
host {{ elasticsearch_address }} host {{ elasticsearch_address }}
@ -41,5 +51,17 @@
logstash_prefix {{ kibana_log_prefix }} logstash_prefix {{ kibana_log_prefix }}
flush_interval 15s flush_interval 15s
</store> </store>
{% elif enable_monasca | bool %}
type copy
<store>
@type monasca
keystone_url {{ keystone_internal_url }}
monasca_log_api {{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ monasca_log_api_port }}
monasca_log_api_version v3.0
username {{ monasca_agent_user }}
password {{ monasca_agent_password }}
domain_id default
project_name {{ monasca_control_plane_project }}
</store>
{% endif %} {% endif %}
</match> </match>

View File

@ -0,0 +1,13 @@
<match *.**>
type copy
<store>
@type monasca
keystone_url {{ keystone_internal_url }}
monasca_log_api {{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ monasca_log_api_port }}
monasca_log_api_version v3.0
username {{ monasca_agent_user }}
password {{ monasca_agent_password }}
domain_id default
project_name {{ monasca_control_plane_project }}
</store>
</match>