diff --git a/ansible/roles/common/templates/heka-openstack.toml.j2 b/ansible/roles/common/templates/heka-openstack.toml.j2 index 5831b30d22..668b6dad2b 100644 --- a/ansible/roles/common/templates/heka-openstack.toml.j2 +++ b/ansible/roles/common/templates/heka-openstack.toml.j2 @@ -6,5 +6,5 @@ filename = "lua_decoders/os_openstack_log.lua" type = "LogstreamerInput" decoder = "openstack_log_decoder" log_directory = "/var/log/kolla" -file_match = '(?Pnova)/(?P.*)\.log' +file_match = '(?Pnova|glance)/(?P.*)\.log' differentiator = ["Service", "_", "Program"] diff --git a/ansible/roles/common/templates/rsyslog.conf.j2 b/ansible/roles/common/templates/rsyslog.conf.j2 index 896559be8b..b808c07431 100644 --- a/ansible/roles/common/templates/rsyslog.conf.j2 +++ b/ansible/roles/common/templates/rsyslog.conf.j2 @@ -10,12 +10,6 @@ $RepeatedMsgReduction on $template KollaToolboxFile,"/var/log/kolla_toolbox.log" :syslogtag,contains,"toolbox" ?KollaToolboxFile -$template GlanceApiFile,"/var/log/glance/glance_api.log" -:syslogtag,contains,"glance-api" ?GlanceApiFile - -$template GlanceRegistryFile,"/var/log/glance/glance_registry.log" -:syslogtag,contains,"glance-registry" ?GlanceRegistryFile - $template HeatAPIFile,"/var/log/heat/heat-api.log" :syslogtag,contains,"heat-api" ?HeatAPIFile diff --git a/ansible/roles/glance/tasks/bootstrap.yml b/ansible/roles/glance/tasks/bootstrap.yml index 800a04e54a..6b8221e197 100644 --- a/ansible/roles/glance/tasks/bootstrap.yml +++ b/ansible/roles/glance/tasks/bootstrap.yml @@ -52,6 +52,7 @@ volumes: - "{{ node_config_directory }}/glance-api/:{{ container_config_directory }}/:ro" - "glance:/var/lib/glance/" + - "kolla_logs:/var/log/kolla/" run_once: True delegate_to: "{{ groups['glance-api'][0] }}" when: database_created diff --git a/ansible/roles/glance/tasks/start.yml b/ansible/roles/glance/tasks/start.yml index 50718cc389..28e10f89a2 100644 --- a/ansible/roles/glance/tasks/start.yml +++ b/ansible/roles/glance/tasks/start.yml @@ -7,7 +7,7 @@ name: "glance_registry" volumes: - "{{ node_config_directory }}/glance-registry/:{{ container_config_directory }}/:ro" - - "rsyslog_socket:/var/lib/kolla/rsyslog/" + - "kolla_logs:/var/log/kolla/" when: inventory_hostname in groups['glance-registry'] - name: Starting glance-api container @@ -19,5 +19,5 @@ volumes: - "{{ node_config_directory }}/glance-api/:{{ container_config_directory }}/:ro" - "glance:/var/lib/glance/" - - "rsyslog_socket:/var/lib/kolla/rsyslog/" + - "kolla_logs:/var/log/kolla/" when: inventory_hostname in groups['glance-api'] diff --git a/ansible/roles/glance/templates/glance-api.conf.j2 b/ansible/roles/glance/templates/glance-api.conf.j2 index 685b2049ec..a62c18ec5d 100644 --- a/ansible/roles/glance/templates/glance-api.conf.j2 +++ b/ansible/roles/glance/templates/glance-api.conf.j2 @@ -1,15 +1,15 @@ [DEFAULT] debug = {{ glance_logging_debug }} +# NOTE(elemoine) log_dir alone does not work for Glance +log_file = /var/log/kolla/glance/api.log + bind_host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} bind_port = {{ glance_api_port }} registry_host = {{ kolla_internal_address }} -use_syslog = True -syslog_log_facility = LOG_LOCAL0 - {% if enable_ceph | bool %} show_image_direct_url= True {% endif %} diff --git a/ansible/roles/glance/templates/glance-registry.conf.j2 b/ansible/roles/glance/templates/glance-registry.conf.j2 index db3e58c803..2310c920f7 100644 --- a/ansible/roles/glance/templates/glance-registry.conf.j2 +++ b/ansible/roles/glance/templates/glance-registry.conf.j2 @@ -1,13 +1,13 @@ [DEFAULT] debug = {{ glance_logging_debug }} +# NOTE(elemoine) log_dir alone does not work for Glance +log_file = /var/log/kolla/glance/registry.log + bind_host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} bind_port = {{ glance_registry_port }} -use_syslog = True -syslog_log_facility = LOG_LOCAL0 - [database] connection = mysql+pymysql://{{ glance_database_user }}:{{ glance_database_password }}@{{ glance_database_address }}/{{ glance_database_name }} diff --git a/docker/glance/glance-api/extend_start.sh b/docker/glance/glance-api/extend_start.sh index 4b99201c9c..aa0372fdcc 100644 --- a/docker/glance/glance-api/extend_start.sh +++ b/docker/glance/glance-api/extend_start.sh @@ -1,5 +1,12 @@ #!/bin/bash +if [[ ! -d "/var/log/kolla/glance" ]]; then + mkdir -p /var/log/kolla/glance +fi +if [[ $(stat -c %a /var/log/kolla/glance) != "755" ]]; then + chmod 755 /var/log/kolla/glance +fi + # Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases # of the KOLLA_BOOTSTRAP variable being set, including empty. if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then diff --git a/docker/glance/glance-base/Dockerfile.j2 b/docker/glance/glance-base/Dockerfile.j2 index 7a53efa765..74edfc72df 100644 --- a/docker/glance/glance-base/Dockerfile.j2 +++ b/docker/glance/glance-base/Dockerfile.j2 @@ -44,14 +44,16 @@ ADD glance-base-archive /glance-base-source RUN ln -s glance-base-source/* glance \ && useradd --user-group glance \ && /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt /glance \ - && mkdir -p /etc/glance /var/log/glance /var/lib/glance /home/glance \ + && mkdir -p /etc/glance /var/lib/glance /home/glance \ && cp -r /glance/etc/* /etc/glance/ \ - && chown -R glance: /etc/glance /var/log/glance /var/lib/glance /home/glance + && chown -R glance: /etc/glance /var/lib/glance /home/glance {% endif %} COPY glance_sudoers /etc/sudoers.d/glance_sudoers +COPY extend_start.sh /usr/local/bin/kolla_extend_start RUN usermod -a -G kolla glance \ && chmod 750 /etc/sudoers.d \ - && chmod 440 /etc/sudoers.d/glance_sudoers + && chmod 440 /etc/sudoers.d/glance_sudoers \ + && chmod 755 /usr/local/bin/kolla_extend_start diff --git a/docker/glance/glance-base/extend_start.sh b/docker/glance/glance-base/extend_start.sh new file mode 100644 index 0000000000..467a2e1888 --- /dev/null +++ b/docker/glance/glance-base/extend_start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +if [[ ! -d "/var/log/kolla/glance" ]]; then + mkdir -p /var/log/kolla/glance +fi +if [[ $(stat -c %a /var/log/kolla/glance) != "755" ]]; then + chmod 755 /var/log/kolla/glance +fi