From 603bbae0f49f1e05156cae1a377b561938cef233 Mon Sep 17 00:00:00 2001
From: Michal Jastrzebski <inc007@gmail.com>
Date: Wed, 23 Sep 2015 13:40:45 +0200
Subject: [PATCH] Heat logging to rsyslog

Configure heat to use rsyslog container as logging mechanism

Change-Id: I71691bbc7c8cb56758e3597da7f44445a4bf5599
Implements: bp logging-container
---
 ansible/roles/common/templates/rsyslog.conf.j2 |  9 +++++++++
 ansible/roles/heat/tasks/start.yml             | 12 +++++++++---
 ansible/roles/heat/templates/heat.conf.j2      |  3 +++
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/ansible/roles/common/templates/rsyslog.conf.j2 b/ansible/roles/common/templates/rsyslog.conf.j2
index d040a1933..61350926a 100755
--- a/ansible/roles/common/templates/rsyslog.conf.j2
+++ b/ansible/roles/common/templates/rsyslog.conf.j2
@@ -33,6 +33,15 @@ $template NovaSchedulerFile,"/var/log/nova/nova-scheduler.log"
 $template NovaComputeFile,"/var/log/nova/nova-compute.log"
 :syslogtag,contains,"nova-compute" ?NovaComputeFile
 
+$template HeatAPIFile,"/var/log/heat/heat-api.log"
+:syslogtag,contains,"heat-api" ?HeatAPIFile
+
+$template HeatAPICfnFile,"/var/log/heat/heat-api-cfn.log"
+:syslogtag,contains,"heat-api-cfn" ?HeatAPICfnFile
+
+$template HeatEngineFile,"/var/log/heat/heat-engine.log"
+:syslogtag,contains,"heat-engine" ?HeatEngineFile
+
 $template DynFile,"/var/log/syslog.log"
 *.* ?DynFile
 & ~
diff --git a/ansible/roles/heat/tasks/start.yml b/ansible/roles/heat/tasks/start.yml
index c388f43f3..9ba7a1b28 100644
--- a/ansible/roles/heat/tasks/start.yml
+++ b/ansible/roles/heat/tasks/start.yml
@@ -13,7 +13,9 @@
     insecure_registry: "{{ docker_insecure_registry }}"
     name: heat_api
     image: "{{ heat_api_image_full }}"
-    volumes: "{{ node_config_directory }}/heat-api/:/opt/kolla/config_files/:ro"
+    volumes:
+      - "{{ node_config_directory }}/heat-api/:/opt/kolla/config_files/:ro"
+      - "/var/lib/kolla/dev/log:/dev/log"
     env:
       KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
   when: inventory_hostname in groups['heat-api']
@@ -32,7 +34,9 @@
     insecure_registry: "{{ docker_insecure_registry }}"
     name: heat_api_cfn
     image: "{{ heat_api_cfn_image_full }}"
-    volumes: "{{ node_config_directory }}/heat-api-cfn/:/opt/kolla/config_files/:ro"
+    volumes:
+      - "{{ node_config_directory }}/heat-api-cfn/:/opt/kolla/config_files/:ro"
+      - "/var/lib/kolla/dev/log:/dev/log"
     env:
       KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
   when: inventory_hostname in groups['heat-api-cfn']
@@ -51,7 +55,9 @@
     insecure_registry: "{{ docker_insecure_registry }}"
     name: heat_engine
     image: "{{ heat_engine_image_full }}"
-    volumes: "{{ node_config_directory }}/heat-engine/:/opt/kolla/config_files/:ro"
+    volumes:
+      - "{{ node_config_directory }}/heat-engine/:/opt/kolla/config_files/:ro"
+      - "/var/lib/kolla/dev/log:/dev/log"
     env:
       KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
   when: inventory_hostname in groups['heat-engine']
diff --git a/ansible/roles/heat/templates/heat.conf.j2 b/ansible/roles/heat/templates/heat.conf.j2
index 8615156d7..e074f75ad 100644
--- a/ansible/roles/heat/templates/heat.conf.j2
+++ b/ansible/roles/heat/templates/heat.conf.j2
@@ -11,6 +11,9 @@ rpc_backend = rabbit
 notification_driver = noop
 deferred_auth_method = password
 
+syslog_log_facility=LOG_LOCAL0
+use_syslog=yes
+
 [oslo_messaging_rabbit]
 rabbit_host = {{ kolla_internal_address }}
 rabbit_userid = {{ rabbitmq_user }}
-- 
GitLab