Docker Logging Support

Support configuring the services to just dump out to stdout/error to
get picked up by docker logging mechanisms. This allows kubectl logs
and kubernetes log plugins to be supported out of the box.

Change-Id: If572f8d2657b0ae7a97f5a9fa0bc17697de740a3
Partially-Implements: blueprint centralized-logging
Partially-Implements: blueprint docker-logging
This commit is contained in:
Kevin Fox 2017-04-20 13:37:11 -07:00
parent 5ef59653e5
commit d634fa6a9e
20 changed files with 108 additions and 8 deletions

View File

@ -20,6 +20,8 @@ node_config_directory: "/etc/kolla/{{ project }}"
# Kolla options
###################
std_logger: true
# Which orchestration engine to use. Valid options are [ ANSIBLE, KUBERNETES ]
orchestration_engine: "KUBERNETES"

View File

@ -1,9 +1,16 @@
[global]
{% if std_logger %}
log to syslog = false
err to syslog = false
log to stderr = true
err to stderr = true
{% else %}
log file = /var/log/kolla/ceph/$cluster-$name.log
log to syslog = false
err to syslog = false
log to stderr = false
err to stderr = false
{% endif %}
fsid = {{ ceph_cluster_fsid }}

View File

@ -1,12 +1,18 @@
[DEFAULT]
debug = {{ cinder_logging_debug }}
log_dir = /var/log/kolla/cinder
use_forwarded_for = true
{% if std_logger %}
use_syslog = False
use_stderr = True
{% else %}
log_dir = /var/log/kolla/cinder
# Set use_stderr to False or the logs will also be sent to stderr
# and collected by Docker
use_stderr = False
{% endif %}
enable_v1_api=false
osapi_volume_workers = {{ openstack_service_workers }}

View File

@ -1,9 +1,15 @@
[DEFAULT]
debug = {{ glance_logging_debug }}
use_forwarded_for = true
{% if std_logger %}
use_syslog = False
use_stderr = True
{% else %}
# NOTE(elemoine) log_dir alone does not work for Glance
log_file = /var/log/kolla/glance/api.log
use_forwarded_for = true
{% endif %}
bind_host = {{ api_interface_address }}
bind_port = {{ glance_api_port }}

View File

@ -1,8 +1,13 @@
[DEFAULT]
debug = {{ glance_logging_debug }}
{% if std_logger %}
use_syslog = False
use_stderr = True
{% else %}
# NOTE(elemoine) log_dir alone does not work for Glance
log_file = /var/log/kolla/glance/registry.log
{% endif %}
bind_host = {{ api_interface_address }}
bind_port = {{ glance_registry_port }}

View File

@ -1,7 +1,12 @@
[DEFAULT]
debug = {{ heat_logging_debug }}
{% if std_logger %}
use_syslog = False
use_stderr = True
{% else %}
log_dir = /var/log/kolla/heat
{% endif %}
heat_watch_server_url = {{ public_protocol }}://{{ kolla_external_fqdn }}:{{ heat_api_cfn_port }}
heat_metadata_server_url = {{ public_protocol }}://{{ kolla_external_fqdn }}:{{ heat_api_cfn_port }}

View File

@ -3,8 +3,13 @@ Listen {{ api_interface_address }}:{{ horizon_port }}
<VirtualHost *:{{ horizon_port }}>
LogLevel warn
{% if std_logger %}
ErrorLog /proc/self/fd/2
CustomLog /proc/self/fd/1 combined
{% else %}
ErrorLog /var/log/kolla/horizon/horizon.log
CustomLog /var/log/kolla/horizon/horizon-access.log combined
{% endif %}
WSGIScriptReloading On
WSGIDaemonProcess horizon-http processes={{ openstack_service_workers }} threads=1 user=horizon group=horizon display-name=%{GROUP} python-path={{ python_path }}

View File

@ -1,6 +1,12 @@
[DEFAULT]
debug = {{ ironic_logging_debug }}
{% if std_logger %}
use_syslog = False
use_stderr = True
{% else %}
log_dir = /var/log/kolla/ironic
{% endif %}
listen_address = 0.0.0.0
listen_port = {{ ironic_inspector_port }}

View File

@ -1,7 +1,12 @@
[DEFAULT]
debug = {{ ironic_logging_debug }}
{% if std_logger %}
use_syslog = False
use_stderr = True
{% else %}
log_dir = /var/log/kolla/ironic
{% endif %}
admin_user = {{ openstack_auth.username }}
admin_password = {{ keystone_admin_password }}

View File

@ -5,9 +5,14 @@ notification_format = cadf
transport_url = rabbit://{{ rabbitmq_user }}:{{ rabbitmq_password }}@rabbitmq:{{ rabbitmq_port }}
{% endif %}
{% if std_logger %}
use_syslog = False
use_stderr = True
{% else %}
# NOTE(elemoine) log_dir alone does not work for Keystone
log_file = /var/log/kolla/keystone/keystone.log
use_stderr = True
{% endif %}
secure_proxy_ssl_header = HTTP_X_FORWARDED_PROTO

View File

@ -12,9 +12,14 @@ Listen {{ api_interface_address }}:{{ keystone_admin_port }}
<IfVersion >= 2.4>
ErrorLogFormat "%{cu}t %M"
</IfVersion>
ErrorLog "{{ keystone_log_dir }}/keystone-apache-public-error.log"
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" logformat
{% if std_logger %}
ErrorLog /proc/self/fd/2
CustomLog /proc/self/fd/1 combined
{% else %}
ErrorLog "{{ keystone_log_dir }}/keystone-apache-public-error.log"
CustomLog "{{ keystone_log_dir }}/keystone-apache-public-access.log" logformat
{% endif %}
</VirtualHost>
<VirtualHost *:{{ keystone_admin_port }}>
@ -26,7 +31,12 @@ Listen {{ api_interface_address }}:{{ keystone_admin_port }}
<IfVersion >= 2.4>
ErrorLogFormat "%{cu}t %M"
</IfVersion>
ErrorLog "{{ keystone_log_dir }}/keystone-apache-admin-error.log"
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" logformat
{% if std_logger %}
ErrorLog /proc/self/fd/2
CustomLog /proc/self/fd/1 combined
{% else %}
ErrorLog "{{ keystone_log_dir }}/keystone-apache-admin-error.log"
CustomLog "{{ keystone_log_dir }}/keystone-apache-admin-access.log" logformat
{% endif %}
</VirtualHost>

View File

@ -8,7 +8,9 @@ default-character-set=utf8
bind-address={{ api_interface_address }}
port={{ mariadb_port }}
{% if not std_logger %}
log-error=/var/log/kolla/mariadb/mariadb.log
{% endif %}
log-bin=mysql-bin
binlog_format=ROW

View File

@ -1 +1,8 @@
{% if std_logger %}
#FIXME(kfox1111) This breaks things for some reason... I suspect a parent process is
#reading stdout. Come up with an alternate solution in a follow on PS for this issue.
#log-facility=-
log-facility=/var/log/kolla/neutron/dnsmasq.log
{% else %}
log-facility=/var/log/kolla/neutron/dnsmasq.log
{% endif %}

View File

@ -2,12 +2,17 @@
[DEFAULT]
debug = {{ neutron_logging_debug }}
log_dir = /var/log/kolla/neutron
{% if std_logger %}
use_syslog = False
use_stderr = True
{% else %}
# NOTE(elemoine): set use_stderr to False or the logs will also be sent to
# stderr and collected by Docker
use_stderr = False
log_dir = /var/log/kolla/neutron
{% endif %}
bind_host = {{ api_interface_address }}
bind_port = {{ neutron_server_port }}

View File

@ -1,4 +1,4 @@
{
"command": "start-ovsdb-server {{ api_interface_address }} {% if orchestration_engine == 'KUBERNETES' %} {{ neutron_bridge_name }} {{ neutron_external_interface }} {% endif %}",
"command": "start-ovsdb-server {{ api_interface_address }} {{ neutron_bridge_name }} {{ neutron_external_interface }}",
"config_files": []
}

View File

@ -1,4 +1,8 @@
{
{% if std_logger %}
"command": "/usr/sbin/ovs-vswitchd unix:/run/openvswitch/db.sock -vconsole:emer -vsyslog:err -vfile:info --mlockall",
{% else %}
"command": "/usr/sbin/ovs-vswitchd unix:/run/openvswitch/db.sock -vconsole:emer -vsyslog:err -vfile:info --mlockall --log-file=/var/log/kolla/openvswitch/ovs-vswitchd.log",
{% endif %}
"config_files": []
}

View File

@ -3,5 +3,11 @@ listen_tls = 0
auth_tcp = "none"
ca_file = ""
log_level = 3
{% if std_logger %}
log_outputs = "3:stderr"
{% else %}
log_outputs = "3:file:/var/log/kolla/libvirt/libvirtd.log"
{% endif %}
listen_addr = "{{ api_interface_address }}"

View File

@ -2,7 +2,12 @@
[DEFAULT]
debug = {{ nova_logging_debug }}
{% if std_logger %}
use_syslog = False
use_stderr = True
{% else %}
log_dir = /var/log/kolla/nova
{% endif %}
state_path = /var/lib/nova

View File

@ -12,9 +12,14 @@ Listen {{ api_interface_address }}:{{ placement_api_port }}
<IfVersion >= 2.4>
ErrorLogFormat "%{cu}t %M"
</IfVersion>
ErrorLog "{{ log_dir }}/placement-api.log"
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" logformat
{% if std_logger %}
ErrorLog /proc/self/fd/2
CustomLog /proc/self/fd/1 combined
{% else %}
ErrorLog "{{ log_dir }}/placement-api.log"
CustomLog "{{ log_dir }}/placement-api-access.log" logformat
{% endif %}
<Directory {{ wsgi_directory }}>
<Files nova-placement-api>
Require all granted

View File

@ -1,6 +1,10 @@
RABBITMQ_NODENAME=rabbit
{% if std_logger %}
RABBITMQ_LOGS=-
{% else %}
RABBITMQ_LOG_BASE=/var/log/kolla/rabbitmq
{% endif %}
# TODO(sdake, vhosakot)
# erlang by default binds to wildcard (all interfaces) and can potentially