Add option for heat containers to log to stdout/stderr

This adds the option to get the heat containers to log to stdout.
The option is disabled by default.

If enabled, It also adds a sidecar container that reads the apache
access logs.

bp logging-stdout-rsyslog

Depends-On: Iae6a86cb93305cb3307e058cfd31e0fca3b1be8e
Change-Id: Iac79232bc981fff365faa818afde72e38fc176fb
changes/38/515038/8
Juan Antonio Osorio Robles 5 years ago committed by Jiri Stransky
parent 759d10770d
commit 97e3a2fd0d
  1. 18
      docker/services/heat-api-cfn.yaml
  2. 21
      docker/services/heat-api.yaml
  3. 28
      docker/services/heat-engine.yaml
  4. 28
      docker/services/logging/files/heat-api-cfn.yaml
  5. 28
      docker/services/logging/files/heat-api.yaml
  6. 39
      docker/services/logging/files/heat-engine.yaml
  7. 60
      docker/services/logging/stdout/heat-api-cfn.yaml
  8. 60
      docker/services/logging/stdout/heat-api.yaml
  9. 22
      docker/services/logging/stdout/heat-engine.yaml
  10. 3
      environments/stdout-logging.yaml
  11. 5
      overcloud-resource-registry-puppet.j2.yaml

@ -60,6 +60,9 @@ resources:
RoleName: {get_param: RoleName}
RoleParameters: {get_param: RoleParameters}
HeatApiCfnLogging:
type: OS::TripleO::Services::Logging::HeatApiCfn
outputs:
role_data:
description: Role data for the Heat API CFN role.
@ -68,6 +71,7 @@ outputs:
config_settings:
map_merge:
- get_attr: [HeatBase, role_data, config_settings]
- get_attr: [HeatApiCfnLogging, config_settings]
- apache::default_vhost: false
logging_source: {get_attr: [HeatBase, role_data, logging_source]}
logging_groups: {get_attr: [HeatBase, role_data, logging_groups]}
@ -93,6 +97,8 @@ outputs:
owner: heat:heat
recurse: true
docker_config:
step_2:
get_attr: [HeatApiCfnLogging, docker_config, step_2]
step_4:
heat_api_cfn:
image: {get_param: DockerHeatApiCfnImage}
@ -107,11 +113,10 @@ outputs:
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
- {get_attr: [HeatApiCfnLogging, volumes]}
-
- /var/lib/kolla/config_files/heat_api_cfn.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/heat_api_cfn/:/var/lib/kolla/config_files/src:ro
- /var/log/containers/heat:/var/log/heat
- /var/log/containers/httpd/heat-api-cfn:/var/log/httpd
-
if:
- internal_tls_enabled
@ -124,14 +129,7 @@ outputs:
- ''
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks:
- name: create persistent logs directory
file:
path: "{{ item }}"
state: directory
with_items:
- /var/log/containers/heat
- /var/log/containers/httpd/heat-api-cfn
host_prep_tasks: {get_attr: [HeatApiCfnLogging, host_prep_tasks]}
upgrade_tasks:
- name: Check if heat_api_cfn is deployed
command: systemctl is-enabled openstack-heat-api-cfn

@ -60,6 +60,9 @@ resources:
RoleName: {get_param: RoleName}
RoleParameters: {get_param: RoleParameters}
HeatApiLogging:
type: OS::TripleO::Services::Logging::HeatApi
outputs:
role_data:
description: Role data for the Heat API role.
@ -68,6 +71,7 @@ outputs:
config_settings:
map_merge:
- get_attr: [HeatBase, role_data, config_settings]
- get_attr: [HeatApiLogging, config_settings]
- apache::default_vhost: false
step_config: &step_config
get_attr: [HeatBase, role_data, step_config]
@ -104,6 +108,8 @@ outputs:
owner: heat:heat
recurse: true
docker_config:
step_2:
get_attr: [HeatApiLogging, docker_config, step_2]
step_4:
heat_api:
image: {get_param: DockerHeatApiImage}
@ -118,11 +124,10 @@ outputs:
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
- {get_attr: [HeatApiLogging, volumes]}
-
- /var/lib/kolla/config_files/heat_api.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/heat_api/:/var/lib/kolla/config_files/src:ro
- /var/log/containers/heat:/var/log/heat
- /var/log/containers/httpd/heat-api:/var/log/httpd
-
if:
- internal_tls_enabled
@ -144,21 +149,13 @@ outputs:
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
- {get_attr: [HeatApiLogging, volumes]}
-
- /var/lib/kolla/config_files/heat_api_cron.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/heat_api/:/var/lib/kolla/config_files/src:ro
- /var/log/containers/heat:/var/log/heat
- /var/log/containers/httpd/heat-api:/var/log/httpd
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks:
- name: create persistent logs directory
file:
path: "{{ item }}"
state: directory
with_items:
- /var/log/containers/heat
- /var/log/containers/httpd/heat-api
host_prep_tasks: {get_attr: [HeatApiLogging, host_prep_tasks]}
upgrade_tasks:
- name: Check is heat_api is deployed
command: systemctl is-enabled openstack-heat-api

@ -55,6 +55,9 @@ resources:
RoleName: {get_param: RoleName}
RoleParameters: {get_param: RoleParameters}
HeatEngineLogging:
type: OS::TripleO::Services::Logging::HeatEngine
outputs:
role_data:
description: Role data for the Heat Engine role.
@ -80,7 +83,11 @@ outputs:
config_image: {get_param: DockerHeatConfigImage}
kolla_config:
/var/lib/kolla/config_files/heat_engine.json:
command: /usr/bin/heat-engine --config-file /usr/share/heat/heat-dist.conf --config-file /etc/heat/heat.conf
command:
list_join:
- ' '
- - /usr/bin/heat-engine --config-file /usr/share/heat/heat-dist.conf --config-file /etc/heat/heat.conf
- get_attr: [HeatEngineLogging, cmd_extra_args]
config_files:
- source: "/var/lib/kolla/config_files/src/*"
dest: "/"
@ -93,15 +100,10 @@ outputs:
docker_config:
# db sync runs before permissions set by kolla_config
step_2:
heat_init_log:
image: &heat_engine_image {get_param: DockerHeatEngineImage}
user: root
volumes:
- /var/log/containers/heat:/var/log/heat
command: ['/bin/bash', '-c', 'chown -R heat:heat /var/log/heat']
get_attr: [HeatEngineLogging, docker_config, step_2]
step_3:
heat_engine_db_sync:
image: *heat_engine_image
image: &heat_engine_image {get_param: DockerHeatEngineImage}
net: host
privileged: false
detach: false
@ -109,10 +111,10 @@ outputs:
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
- {get_attr: [HeatEngineLogging, volumes]}
-
- /var/lib/config-data/heat/etc/my.cnf.d/tripleo.cnf:/etc/my.cnf.d/tripleo.cnf:ro
- /var/lib/config-data/heat/etc/heat/:/etc/heat/:ro
- /var/log/containers/heat:/var/log/heat
command: "/usr/bin/bootstrap_host_exec heat_engine su heat -s /bin/bash -c 'heat-manage db_sync'"
step_4:
heat_engine:
@ -125,17 +127,13 @@ outputs:
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
- {get_attr: [HeatEngineLogging, volumes]}
-
- /var/lib/kolla/config_files/heat_engine.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/heat/:/var/lib/kolla/config_files/src:ro
- /var/log/containers/heat:/var/log/heat
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks:
- name: create persistent logs directory
file:
path: /var/log/containers/heat
state: directory
host_prep_tasks: {get_attr: [HeatEngineLogging, host_prep_tasks]}
upgrade_tasks:
- name: Stop and disable heat_engine service
tags: step2

@ -0,0 +1,28 @@
heat_template_version: pike
description: >
OpenStack containerized Heat API CFN service
outputs:
config_settings:
description: Extra hieradata needed to log to files in the host.
value: null
docker_config:
description: Extra containers needed for logging to files in the host.
value:
step_2: {}
volumes:
description: The volumes needed to log to files in the host.
value:
- /var/log/containers/heat:/var/log/heat
- /var/log/containers/httpd/heat-api-cfn:/var/log/httpd
host_prep_tasks:
description: Extra ansible tasks needed for logging to files in the host.
value:
- name: create persistent logs directory
file:
path: "{{ item }}"
state: directory
with_items:
- /var/log/containers/heat
- /var/log/containers/httpd/heat-api-cfn

@ -0,0 +1,28 @@
heat_template_version: pike
description: >
OpenStack containerized Heat API service
outputs:
config_settings:
description: Extra hieradata needed to log to files in the host.
value: null
docker_config:
description: Extra containers needed for logging to files in the host.
value:
step_2: {}
volumes:
description: The volumes needed to log to files in the host.
value:
- /var/log/containers/heat:/var/log/heat
- /var/log/containers/httpd/heat-api:/var/log/httpd
host_prep_tasks:
description: Extra ansible tasks needed for logging to files in the host.
value:
- name: create persistent logs directory
file:
path: "{{ item }}"
state: directory
with_items:
- /var/log/containers/heat
- /var/log/containers/httpd/heat-api

@ -0,0 +1,39 @@
heat_template_version: pike
description: >
OpenStack containerized Glance API service
parameters:
DockerHeatEngineImage:
description: image
type: string
outputs:
cmd_extra_args:
description: Extra command line arguments for running the service in the container.
value: ''
config_settings:
description: Extra hieradata needed to log to files in the host.
value: null
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:
heat_init_log:
image: {get_param: DockerHeatEngineImage}
user: root
volumes:
- /var/log/containers/heat:/var/log/heat
command: ['/bin/bash', '-c', 'chown -R heat:heat /var/log/heat']
volumes:
description: The volumes needed to log to files in the host.
value:
- /var/log/containers/heat:/var/log/heat
host_prep_tasks:
description: Extra ansible tasks needed for logging to files in the host.
value:
- name: create persistent logs directory
file:
path: /var/log/containers/heat
state: directory

@ -0,0 +1,60 @@
heat_template_version: pike
description: >
OpenStack containerized Heat API CFN service
parameters:
DockerHeatApiCfnImage:
description: image
type: string
outputs:
config_settings:
description: Extra hieradata needed to log to stdout.
value:
heat::wsgi::apache_api_cfn::access_log_file: /var/log/httpd/access.log
heat::wsgi::apache_api_cfn::error_log_file: /var/log/httpd/error_log
docker_config:
description: Extra containers needed for logging to stdout or a sidecar container.
value:
step_2:
heat_api_cfn_apache_error_logs:
start_order: 1
image: {get_param: DockerHeatApiCfnImage}
user: root
privileged: false
restart: always
healthcheck:
test: '[ -p /var/log/httpd/error_log ]'
command: ['/bin/bash', '-c', 'mkdir -p /var/log/httpd && rm -f /var/log/httpd/error_log && mkfifo /var/log/httpd/error_log && while true; do cat /var/log/httpd/error_log; done']
volumes:
- HeatApiCfnLogs:/var/log/
heat_api_cfn_apache_access_logs:
start_order: 1
image: {get_param: DockerHeatApiCfnImage}
user: root
privileged: false
restart: always
healthcheck:
test: '[ -p /var/log/httpd/access.log ]'
command: ['/bin/bash', '-c', 'mkdir -p /var/log/httpd && rm -f /var/log/httpd/access.log && mkfifo /var/log/httpd/access.log && while true; do cat /var/log/httpd/access.log; done']
volumes:
- HeatApiCfnLogs:/var/log/
heat_api_cfn_logs:
start_order: 2
image: {get_param: DockerHeatApiCfnImage}
user: heat
privileged: false
restart: always
healthcheck:
test: '[ -p /var/log/heat/heat_api_cfn.log ]'
command: ['/bin/bash', '-c', 'mkdir -p /var/log/heat && rm -f /var/log/heat/heat_api_cfn.log && mkfifo /var/log/heat/heat_api_cfn.log && while true; do cat /var/log/heat/heat_api_cfn.log; done']
volumes:
- HeatApiCfnLogs:/var/log/
volumes:
description: The volumes needed to log to stdout or a sidecar container.
value:
- HeatApiCfnLogs:/var/log/
host_prep_tasks:
description: Extra ansible tasks needed for logging to files in the host.
value: null

@ -0,0 +1,60 @@
heat_template_version: pike
description: >
OpenStack containerized Heat API service
parameters:
DockerHeatApiImage:
description: image
type: string
outputs:
config_settings:
description: Extra hieradata needed to log to stdout.
value:
heat::wsgi::apache_api::access_log_file: /var/log/httpd/access.log
heat::wsgi::apache_api::error_log_file: /var/log/httpd/error_log
docker_config:
description: Extra containers needed for logging to stdout or a sidecar container.
value:
step_2:
heat_api_apache_error_logs:
start_order: 1
image: {get_param: DockerHeatApiImage}
user: root
privileged: false
restart: always
healthcheck:
test: '[ -p /var/log/httpd/error_log ]'
command: ['/bin/bash', '-c', 'mkdir -p /var/log/httpd && rm -f /var/log/httpd/error_log && mkfifo /var/log/httpd/error_log && while true; do cat /var/log/httpd/error_log; done']
volumes:
- HeatApiLogs:/var/log/
heat_api_apache_access_logs:
start_order: 1
image: {get_param: DockerHeatApiImage}
user: root
privileged: false
restart: always
healthcheck:
test: '[ -p /var/log/httpd/access.log ]'
command: ['/bin/bash', '-c', 'mkdir -p /var/log/httpd && rm -f /var/log/httpd/access.log && mkfifo /var/log/httpd/access.log && while true; do cat /var/log/httpd/access.log; done']
volumes:
- HeatApiLogs:/var/log/
heat_api_logs:
start_order: 2
image: {get_param: DockerHeatApiImage}
user: heat
privileged: false
restart: always
healthcheck:
test: '[ -p /var/log/heat/heat_api.log ]'
command: ['/bin/bash', '-c', 'mkdir -p /var/log/heat && rm -f /var/log/heat/heat_api.log && mkfifo /var/log/heat/heat_api.log && while true; do cat /var/log/heat/heat_api.log; done']
volumes:
- HeatApiLogs:/var/log/
volumes:
description: The volumes needed to log to stdout or a sidecar container.
value:
- HeatApiLogs:/var/log/
host_prep_tasks:
description: Extra ansible tasks needed for logging to files in the host.
value: null

@ -0,0 +1,22 @@
heat_template_version: pike
description: >
OpenStack containerized Glance API service
outputs:
cmd_extra_args:
description: Extra command line arguments for running the service in the container.
value: "--log-dir= --log-file="
config_settings:
description: Extra hieradata needed to log to stdout.
value: null
docker_config:
description: Extra containers needed for logging to stdout or a sidecar container.
value:
step_2: {}
volumes:
description: The volumes needed to log to stdout or a sidecar container.
value: null
host_prep_tasks:
description: Extra ansible tasks needed for logging to files in the host.
value: null

@ -1,6 +1,9 @@
resource_registry:
OS::TripleO::Services::Logging::GlanceApi: ../docker/services/logging/stdout/glance-api.yaml
OS::TripleO::Services::Logging::HeatApi: ../docker/services/logging/stdout/heat-api.yaml
OS::TripleO::Services::Logging::HeatApiCfn: ../docker/services/logging/stdout/heat-api-cfn.yaml
OS::TripleO::Services::Logging::HeatEngine: ../docker/services/logging/stdout/heat-engine.yaml
OS::TripleO::Services::Logging::Keystone: ../docker/services/logging/stdout/keystone.yaml
OS::TripleO::Services::Logging::NeutronApi: ../docker/services/logging/stdout/neutron-common.yaml
OS::TripleO::Services::Logging::NeutronCommon: ../docker/services/logging/stdout/neutron-common.yaml

@ -299,13 +299,16 @@ resource_registry:
# Logging
OS::TripleO::Services::Logging::GlanceApi: docker/services/logging/files/glance-api.yaml
OS::TripleO::Services::Logging::HeatApi: docker/services/logging/files/heat-api.yaml
OS::TripleO::Services::Logging::HeatApiCfn: docker/services/logging/files/heat-api-cfn.yaml
OS::TripleO::Services::Logging::HeatEngine: docker/services/logging/files/heat-engine.yaml
OS::TripleO::Services::Logging::Keystone: docker/services/logging/files/keystone.yaml
OS::TripleO::Services::Logging::NeutronApi: docker/services/logging/files/neutron-api.yaml
OS::TripleO::Services::Logging::NeutronCommon: docker/services/logging/files/neutron-common.yaml
OS::TripleO::Services::Logging::NovaApi: docker/services/logging/files/nova-api.yaml
OS::TripleO::Services::Logging::NovaCommon: docker/services/logging/files/nova-common.yaml
OS::TripleO::Services::Logging::NovaPlacement: docker/services/logging/files/nova-placement.yaml
OS::TripleO::Services::Logging::NovaLibvirt: OS::Heat::None
OS::TripleO::Services::Logging::NovaPlacement: docker/services/logging/files/nova-placement.yaml
parameter_defaults:
EnablePackageInstall: false

Loading…
Cancel
Save