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_rsync_port: "10873"
syslog_udp_port: "{{ fluentd_syslog_port }}"
tacker_server_port: "9890"
trove_api_port: "8779"
@ -346,6 +348,7 @@ enable_cloudkitty: "no"
enable_congress: "no"
enable_designate: "no"
enable_etcd: "no"
enable_fluentd: "yes"
enable_freezer: "no"
enable_gnocchi: "no"
enable_grafana: "no"

View File

@ -6,6 +6,7 @@ common_run: False
common_services:
fluentd:
container_name: fluentd
enabled: "{{ enable_fluentd | bool }}"
image: "{{ fluentd_image_full }}"
environment:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
@ -15,6 +16,7 @@ common_services:
- "kolla_logs:/var/log/kolla/"
kolla-toolbox:
container_name: kolla_toolbox
enabled: True
image: "{{ kolla_toolbox_image_full }}"
environment:
ANSIBLE_NOCOLOR: "1"
@ -29,6 +31,7 @@ common_services:
# DUMMY_ENVIRONMENT is needed because empty environment is not supported
cron:
container_name: cron
enabled: True
image: "{{ cron_image_full }}"
environment:
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_tag: "{{ openstack_release }}"
kubetoolbox_image_full: "{{ kubetoolbox_image }}:{{ kubetoolbox_tag }}"
syslog_swift_facility: "local0"
syslog_haproxy_facility: "local1"

View File

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

View File

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

View File

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

View File

@ -41,3 +41,6 @@ haproxy_server_timeout: "1m"
haproxy_glance_api_client_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
group haproxy
daemon
log {{ api_interface_address }}:{{ fluentd_syslog_port }} local1
log {{ syslog_server }}:{{ syslog_udp_port }} {{ syslog_haproxy_facility }}
maxconn 4000
stats socket /var/lib/kolla/haproxy/haproxy.sock
{% if kolla_enable_tls_external | bool %}

View File

@ -48,3 +48,6 @@ swift_devices_match_mode: "strict"
swift_devices_name: "KOLLA_SWIFT_DATA"
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 }}
devices = {{ swift_devices_mount_point }}
mount_check = false
log_udp_host = {{ api_interface_address }}
log_udp_port = {{ fluentd_syslog_port }}
log_udp_host = {{ syslog_server }}
log_udp_port = {{ syslog_udp_port }}
log_name = {{ service_name }}
log_facility = LOG_LOCAL0
log_facility = {{ syslog_swift_facility }}
log_level = INFO
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 }}
devices = {{ swift_devices_mount_point }}
mount_check = false
log_udp_host = {{ api_interface_address }}
log_udp_port = {{ fluentd_syslog_port }}
log_udp_host = {{ syslog_server }}
log_udp_port = {{ syslog_udp_port }}
log_name = {{ service_name }}
log_facility = LOG_LOCAL0
log_facility = {{ syslog_swift_facility }}
log_level = INFO
workers = {{ openstack_service_workers }}

View File

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

View File

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

View File

@ -240,3 +240,22 @@ For example:
As <service>_port value is saved in different services' configuration so
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_destroy_images: "no"
#enable_etcd: "no"
#enable_fluentd: "yes"
#enable_freezer: "no"
#enable_gnocchi: "no"
#enable_grafana: "no"