Merge "Add fluentd enable option"

This commit is contained in:
Zuul 2017-10-02 09:33:00 +00:00 committed by Gerrit Code Review
commit ecbb55117a
14 changed files with 73 additions and 19 deletions

View File

@ -257,6 +257,8 @@ swift_account_server_port: "6001"
swift_container_server_port: "6002" swift_container_server_port: "6002"
swift_rsync_port: "10873" swift_rsync_port: "10873"
syslog_udp_port: "{{ fluentd_syslog_port }}"
tacker_server_port: "9890" tacker_server_port: "9890"
trove_api_port: "8779" trove_api_port: "8779"
@ -346,6 +348,7 @@ enable_cloudkitty: "no"
enable_congress: "no" enable_congress: "no"
enable_designate: "no" enable_designate: "no"
enable_etcd: "no" enable_etcd: "no"
enable_fluentd: "yes"
enable_freezer: "no" enable_freezer: "no"
enable_gnocchi: "no" enable_gnocchi: "no"
enable_grafana: "no" enable_grafana: "no"

View File

@ -6,6 +6,7 @@ common_run: False
common_services: common_services:
fluentd: fluentd:
container_name: fluentd container_name: fluentd
enabled: "{{ enable_fluentd | bool }}"
image: "{{ fluentd_image_full }}" image: "{{ fluentd_image_full }}"
environment: environment:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
@ -15,6 +16,7 @@ common_services:
- "kolla_logs:/var/log/kolla/" - "kolla_logs:/var/log/kolla/"
kolla-toolbox: kolla-toolbox:
container_name: kolla_toolbox container_name: kolla_toolbox
enabled: True
image: "{{ kolla_toolbox_image_full }}" image: "{{ kolla_toolbox_image_full }}"
environment: environment:
ANSIBLE_NOCOLOR: "1" ANSIBLE_NOCOLOR: "1"
@ -29,6 +31,7 @@ common_services:
# DUMMY_ENVIRONMENT is needed because empty environment is not supported # DUMMY_ENVIRONMENT is needed because empty environment is not supported
cron: cron:
container_name: cron container_name: cron
enabled: True
image: "{{ cron_image_full }}" image: "{{ cron_image_full }}"
environment: environment:
DUMMY_ENVIRONMENT: kolla_useless_env DUMMY_ENVIRONMENT: kolla_useless_env
@ -56,3 +59,6 @@ fluentd_image_full: "{{ fluentd_image }}:{{ fluentd_tag }}"
kubetoolbox_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-kubetoolbox" kubetoolbox_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-kubetoolbox"
kubetoolbox_tag: "{{ openstack_release }}" kubetoolbox_tag: "{{ openstack_release }}"
kubetoolbox_image_full: "{{ kubetoolbox_image }}:{{ kubetoolbox_tag }}" kubetoolbox_image_full: "{{ kubetoolbox_image }}:{{ kubetoolbox_tag }}"
syslog_swift_facility: "local0"
syslog_haproxy_facility: "local1"

View File

@ -14,6 +14,7 @@
environment: "{{ service.environment }}" environment: "{{ service.environment }}"
when: when:
- action != "config" - action != "config"
- service.enabled | bool
- config_json.changed | bool - config_json.changed | bool
or fluentd_input.changed | bool or fluentd_input.changed | bool
or fluentd_output.changed | bool or fluentd_output.changed | bool
@ -39,6 +40,7 @@
environment: "{{ service.environment }}" environment: "{{ service.environment }}"
when: when:
- action != "config" - action != "config"
- service.enabled | bool
- config_json.changed | bool - config_json.changed | bool
or kolla_toolbox_container.changed | bool or kolla_toolbox_container.changed | bool
notify: notify:
@ -63,6 +65,7 @@
environment: "{{ service.environment }}" environment: "{{ service.environment }}"
when: when:
- action != "config" - action != "config"
- service.enabled | bool
- config_json.changed | bool - config_json.changed | bool
or cron_confs.changed | bool or cron_confs.changed | bool
or check_common_containers.changed | bool or check_common_containers.changed | bool

View File

@ -1,5 +1,15 @@
--- ---
- name: Ensuring config directories exist - name: Ensuring config directories exist
file:
path: "{{ node_config_directory }}/{{ item }}"
state: "directory"
recurse: yes
with_items:
- "kolla-toolbox"
- "cron"
- "cron/logrotate"
- name: Ensuring fluentd config directories exist
file: file:
path: "{{ node_config_directory }}/{{ item }}" path: "{{ node_config_directory }}/{{ item }}"
state: "directory" state: "directory"
@ -10,15 +20,14 @@
- "fluentd/output" - "fluentd/output"
- "fluentd/format" - "fluentd/format"
- "fluentd/filter" - "fluentd/filter"
- "kolla-toolbox" when: enable_fluentd | bool
- "cron"
- "cron/logrotate"
- name: Copying over config.json files for services - name: Copying over config.json files for services
template: template:
src: "{{ item.key }}.json.j2" src: "{{ item.key }}.json.j2"
dest: "{{ node_config_directory }}/{{ item.key }}/config.json" dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
register: common_config_jsons register: common_config_jsons
when: item.value.enabled | bool
with_dict: "{{ common_services }}" with_dict: "{{ common_services }}"
notify: notify:
- "Restart {{ item.key }} container" - "Restart {{ item.key }} container"
@ -28,6 +37,7 @@
src: "conf/input/{{ item }}.conf.j2" src: "conf/input/{{ item }}.conf.j2"
dest: "{{ node_config_directory }}/fluentd/input/{{ item }}.conf" dest: "{{ node_config_directory }}/fluentd/input/{{ item }}.conf"
register: fluentd_input register: fluentd_input
when: enable_fluentd | bool
with_items: with_items:
- "00-global" - "00-global"
- "01-syslog" - "01-syslog"
@ -43,7 +53,9 @@
src: "conf/output/{{ item.name }}.conf.j2" src: "conf/output/{{ item.name }}.conf.j2"
dest: "{{ node_config_directory }}/fluentd/output/{{ item.name }}.conf" dest: "{{ node_config_directory }}/fluentd/output/{{ item.name }}.conf"
register: fluentd_output register: fluentd_output
when: item.enabled | bool when:
- enable_fluentd | bool
- item.enabled | bool
with_items: with_items:
- name: "00-local" - name: "00-local"
enabled: true enabled: true
@ -78,6 +90,7 @@
with_items: with_items:
- "apache_access" - "apache_access"
- "wsgi_access" - "wsgi_access"
when: enable_fluentd | bool
notify: notify:
- Restart fluentd container - Restart fluentd container
@ -89,6 +102,7 @@
with_items: with_items:
- "00-record_transformer" - "00-record_transformer"
- "01-rewrite" - "01-rewrite"
when: enable_fluentd | bool
notify: notify:
- Restart fluentd container - Restart fluentd container
@ -99,6 +113,7 @@
register: fluentd_td_agent register: fluentd_td_agent
with_items: with_items:
- "fluentd" - "fluentd"
when: enable_fluentd | bool
notify: notify:
- Restart fluentd container - Restart fluentd container
@ -177,6 +192,7 @@
register: check_common_containers register: check_common_containers
when: when:
- action != "config" - action != "config"
- item.value.enabled | bool
with_dict: "{{ common_services }}" with_dict: "{{ common_services }}"
notify: notify:
- "Restart {{ item.key }} container" - "Restart {{ item.key }} container"

View File

@ -1,4 +1,4 @@
<match syslog.local0.**> <match syslog.{{ syslog_swift_facility }}.**>
@type copy @type copy
<store> <store>
@type file @type file
@ -20,7 +20,7 @@
{% endif %} {% endif %}
</match> </match>
<match syslog.local1.**> <match syslog.{{ syslog_haproxy_facility }}.**>
@type copy @type copy
<store> <store>
@type file @type file

View File

@ -41,3 +41,6 @@ haproxy_server_timeout: "1m"
haproxy_glance_api_client_timeout: "6h" haproxy_glance_api_client_timeout: "6h"
haproxy_glance_api_server_timeout: "6h" haproxy_glance_api_server_timeout: "6h"
syslog_server: "{{ api_interface_address }}"
syslog_haproxy_facility: "local1"

View File

@ -4,7 +4,7 @@ global
user haproxy user haproxy
group haproxy group haproxy
daemon daemon
log {{ api_interface_address }}:{{ fluentd_syslog_port }} local1 log {{ syslog_server }}:{{ syslog_udp_port }} {{ syslog_haproxy_facility }}
maxconn 4000 maxconn 4000
stats socket /var/lib/kolla/haproxy/haproxy.sock stats socket /var/lib/kolla/haproxy/haproxy.sock
{% if kolla_enable_tls_external | bool %} {% if kolla_enable_tls_external | bool %}

View File

@ -48,3 +48,6 @@ swift_devices_match_mode: "strict"
swift_devices_name: "KOLLA_SWIFT_DATA" swift_devices_name: "KOLLA_SWIFT_DATA"
openstack_swift_auth: "{{ openstack_auth }}" openstack_swift_auth: "{{ openstack_auth }}"
syslog_server: "{{ api_interface_address }}"
syslog_swift_facility: "local0"

View File

@ -3,10 +3,10 @@ bind_ip = {{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4'
bind_port = {{ swift_account_server_port }} bind_port = {{ swift_account_server_port }}
devices = {{ swift_devices_mount_point }} devices = {{ swift_devices_mount_point }}
mount_check = false mount_check = false
log_udp_host = {{ api_interface_address }} log_udp_host = {{ syslog_server }}
log_udp_port = {{ fluentd_syslog_port }} log_udp_port = {{ syslog_udp_port }}
log_name = {{ service_name }} log_name = {{ service_name }}
log_facility = LOG_LOCAL0 log_facility = {{ syslog_swift_facility }}
log_level = INFO log_level = INFO
workers = {{ openstack_service_workers }} workers = {{ openstack_service_workers }}

View File

@ -3,10 +3,10 @@ bind_ip = {{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4'
bind_port = {{ swift_container_server_port }} bind_port = {{ swift_container_server_port }}
devices = {{ swift_devices_mount_point }} devices = {{ swift_devices_mount_point }}
mount_check = false mount_check = false
log_udp_host = {{ api_interface_address }} log_udp_host = {{ syslog_server }}
log_udp_port = {{ fluentd_syslog_port }} log_udp_port = {{ syslog_udp_port }}
log_name = {{ service_name }} log_name = {{ service_name }}
log_facility = LOG_LOCAL0 log_facility = {{ syslog_swift_facility }}
log_level = INFO log_level = INFO
workers = {{ openstack_service_workers }} workers = {{ openstack_service_workers }}

View File

@ -4,10 +4,10 @@ bind_port = {{ swift_object_server_port }}
devices = {{ swift_devices_mount_point }} devices = {{ swift_devices_mount_point }}
mount_check = false mount_check = false
log_udp_host = {{ api_interface_address }} log_udp_host = {{ syslog_server }}
log_udp_port = {{ fluentd_syslog_port }} log_udp_port = {{ syslog_udp_port }}
log_name = {{ service_name }} log_name = {{ service_name }}
log_facility = LOG_LOCAL0 log_facility = {{ syslog_swift_facility }}
log_level = INFO log_level = INFO
workers = {{ openstack_service_workers }} workers = {{ openstack_service_workers }}

View File

@ -2,10 +2,10 @@
bind_ip = {{ api_interface_address }} bind_ip = {{ api_interface_address }}
bind_port = {{ swift_proxy_server_port }} bind_port = {{ swift_proxy_server_port }}
log_udp_host = {{ api_interface_address }} log_udp_host = {{ syslog_server }}
log_udp_port = {{ fluentd_syslog_port }} log_udp_port = {{ syslog_udp_port }}
log_name = {{ service_name }} log_name = {{ service_name }}
log_facility = LOG_LOCAL0 log_facility = {{ syslog_swift_facility }}
log_level = INFO log_level = INFO
workers = {{ openstack_service_workers }} workers = {{ openstack_service_workers }}

View File

@ -240,3 +240,22 @@ For example:
As <service>_port value is saved in different services' configuration so As <service>_port value is saved in different services' configuration so
it's advised to make above change before deploying. it's advised to make above change before deploying.
Use an external Syslog server
=============================
By default, Fluentd is used as a syslog server to collect Swift and HAProxy
logs. When Fluentd is disabled or you want to use an external syslog server,
You can set syslog parameters in ``globals.yml`` file.
For example:
::
syslog_server: "172.29.9.145"
syslog_udp_port: "514"
You can also set syslog facility names for Swift and HAProxy logs. By default,
Swift and HAProxy use ``local0`` and ``local1``, respectively.
::
syslog_swift_facility: "local0"
syslog_haproxy_facility: "local1"

View File

@ -145,6 +145,7 @@ kolla_internal_vip_address: "10.10.10.254"
#enable_designate: "no" #enable_designate: "no"
#enable_destroy_images: "no" #enable_destroy_images: "no"
#enable_etcd: "no" #enable_etcd: "no"
#enable_fluentd: "yes"
#enable_freezer: "no" #enable_freezer: "no"
#enable_gnocchi: "no" #enable_gnocchi: "no"
#enable_grafana: "no" #enable_grafana: "no"