tripleo-heat-templates/deployment/glance/glance-api-logging-file-container.yaml
Michele Baldessari 53465f7f29 Make sure glance_api_tls_proxy logs are persisted on the host
The logs for the glance_api_tls_proxy containers are not persisted on
the host and hence get lost at the restart of the container.  Said
container has httpd inside of it so we need to make sure that the httpd
logs are persisted on the host just like the other containers that use
httpd.

Tested this review and I correctly get the logs persisted on a
TLS-everywhere environment:
[root@controller-0 ~]# ls -l /var/log/containers/httpd/glance/
total 1040
-rw-r--r--. 1 root root   5864 Nov 28 10:07 error_log
-rw-r--r--. 1 root root 544043 Nov 28 11:17 glance-api-proxy_access_ssl.log
-rw-r--r--. 1 root root   4360 Nov 28 10:07 glance-api-proxy_error_ssl.log

NB: Slight conflict on deployment/glance/glance-api-logging-file-container.yaml

Change-Id: Id4f24e171867adc445eca55b3908360c8f3f6f30
Closes-Bug: #1854343
(cherry picked from commit f22dce4477)
(cherry picked from commit a764b832e2)
2019-11-29 13:53:23 +00:00

51 lines
1.7 KiB
YAML

heat_template_version: rocky
description: >
OpenStack containerized Glance API service
parameters:
DockerGlanceApiImage:
description: image
type: string
outputs:
config_settings:
description: Extra hieradata needed to log to files in the host.
value: null
volumes:
description: The volumes needed to log to files in the host.
value: &glance_api_volumes
- /var/log/containers/glance:/var/log/glance:z
- /var/log/containers/httpd/glance:/var/log/httpd:z
docker_config:
description: Extra containers needed for logging to files in the host.
value:
# Kolla_bootstrap/db_sync runs before permissions set by kolla_config
step_2:
glance_init_logs:
image: {get_param: DockerGlanceApiImage}
net: none
privileged: false
user: root
volumes: *glance_api_volumes
command: ['/bin/bash', '-c', 'chown -R glance:glance /var/log/glance']
host_prep_tasks:
description: Extra ansible tasks needed for logging to files in the host.
value:
- name: create persistent logs directory
file:
path: "{{ item.path }}"
state: directory
setype: "{{ item.setype }}"
with_items:
- { 'path': /var/log/containers/glance, 'setype': svirt_sandbox_file_t }
- { 'path': /var/log/glance, 'setype': svirt_sandbox_file_t }
- { 'path': /var/log/containers/httpd/glance, 'setype': svirt_sandbox_file_t, 'mode': '0750' }
- name: glance logs readme
copy:
dest: /var/log/glance/readme.txt
content: |
Log files from glance containers can be found under
/var/log/containers/glance.
ignore_errors: true