From 1e863081404a4e133a00d17428dc196e475f241e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Wed, 17 Feb 2016 14:36:44 +0100 Subject: [PATCH] Make Heka collect Murano logs Partially implements: blueprint heka Change-Id: I17fc4b838d6ba8b6fcfc5c08314fef5fac1c7aff --- ansible/roles/common/templates/heka-openstack.toml.j2 | 2 +- ansible/roles/common/templates/rsyslog.conf.j2 | 6 ------ ansible/roles/murano/tasks/bootstrap_service.yml | 4 +++- ansible/roles/murano/tasks/start.yml | 4 ++-- ansible/roles/murano/templates/murano.conf.j2 | 4 +--- docker/murano/murano-api/extend_start.sh | 7 +++++++ docker/murano/murano-base/Dockerfile.j2 | 9 ++++++--- docker/murano/murano-base/extend_start.sh | 8 ++++++++ 8 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 docker/murano/murano-base/extend_start.sh diff --git a/ansible/roles/common/templates/heka-openstack.toml.j2 b/ansible/roles/common/templates/heka-openstack.toml.j2 index dc35cef184..2c8bbbdeec 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|glance|keystone|neutron|cinder|heat)/(?P.*)\.log' +file_match = '(?Pnova|glance|keystone|neutron|cinder|heat|murano)/(?P.*)\.log' differentiator = ["Service", "_", "Program"] diff --git a/ansible/roles/common/templates/rsyslog.conf.j2 b/ansible/roles/common/templates/rsyslog.conf.j2 index 91c2c4b990..be49a5ccb7 100644 --- a/ansible/roles/common/templates/rsyslog.conf.j2 +++ b/ansible/roles/common/templates/rsyslog.conf.j2 @@ -7,12 +7,6 @@ $KLogPermitNonKernelFacility on $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat $RepeatedMsgReduction on -$template MuranoEngineFile,"/var/log/murano/murano-engine.log" -:syslogtag,contains,"murano-engine" ?MuranoEngineFile - -$template MuranoApiFile,"/var/log/murano/murano-api.log" -:syslogtag,contains,"murano-api" ?MuranoApiFile - $template MagnumApiFile,"/var/log/magnum/magnum-api.log" :syslogtag,contains,"magnum-api" ?MagnumApiFile diff --git a/ansible/roles/murano/tasks/bootstrap_service.yml b/ansible/roles/murano/tasks/bootstrap_service.yml index 887f05cc56..7d803013c4 100644 --- a/ansible/roles/murano/tasks/bootstrap_service.yml +++ b/ansible/roles/murano/tasks/bootstrap_service.yml @@ -12,6 +12,8 @@ BOOTSTRAP: name: "bootstrap_murano" restart_policy: "never" - volumes: "{{ node_config_directory }}/murano-api/:{{ container_config_directory }}/:ro" + volumes: + - "{{ node_config_directory }}/murano-api/:{{ container_config_directory }}/:ro" + - "kolla_logs:/var/log/kolla/" run_once: True delegate_to: "{{ groups['murano-api'][0] }}" diff --git a/ansible/roles/murano/tasks/start.yml b/ansible/roles/murano/tasks/start.yml index 9a8bd5e798..ff9ca9fe1d 100644 --- a/ansible/roles/murano/tasks/start.yml +++ b/ansible/roles/murano/tasks/start.yml @@ -7,7 +7,7 @@ name: "murano_engine" volumes: - "{{ node_config_directory }}/murano-engine/:{{ container_config_directory }}/:ro" - - "rsyslog_socket:/var/lib/kolla/rsyslog/" + - "kolla_logs:/var/log/kolla/" when: inventory_hostname in groups['murano-engine'] - name: Starting murano-api container @@ -18,5 +18,5 @@ name: "murano_api" volumes: - "{{ node_config_directory }}/murano-api/:{{ container_config_directory }}/:ro" - - "rsyslog_socket:/var/lib/kolla/rsyslog/" + - "kolla_logs:/var/log/kolla/" when: inventory_hostname in groups['murano-api'] diff --git a/ansible/roles/murano/templates/murano.conf.j2 b/ansible/roles/murano/templates/murano.conf.j2 index e0bdda1372..a64cfb54cc 100644 --- a/ansible/roles/murano/templates/murano.conf.j2 +++ b/ansible/roles/murano/templates/murano.conf.j2 @@ -1,9 +1,7 @@ [DEFAULT] debug = {{ murano_logging_debug }} - -use_syslog = True -syslog_log_facility = LOG_LOCAL0 +log_dir = /var/log/kolla/murano {% if service_name == 'murano-api' %} bind_host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} diff --git a/docker/murano/murano-api/extend_start.sh b/docker/murano/murano-api/extend_start.sh index d46b2b0afb..a00a46503d 100644 --- a/docker/murano/murano-api/extend_start.sh +++ b/docker/murano/murano-api/extend_start.sh @@ -1,5 +1,12 @@ #!/bin/bash +if [[ ! -d "/var/log/kolla/murano" ]]; then + mkdir -p /var/log/kolla/murano +fi +if [[ $(stat -c %a /var/log/kolla/murano) != "755" ]]; then + chmod 755 /var/log/kolla/murano +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/murano/murano-base/Dockerfile.j2 b/docker/murano/murano-base/Dockerfile.j2 index ee1337357e..49e372581b 100644 --- a/docker/murano/murano-base/Dockerfile.j2 +++ b/docker/murano/murano-base/Dockerfile.j2 @@ -20,10 +20,13 @@ ADD murano-base-archive /murano-base-source RUN ln -s murano-base-source/* murano \ && useradd --user-group murano \ && /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt /murano \ - && mkdir -p /etc/murano /var/log/murano /home/murano \ + && mkdir -p /etc/murano /home/murano \ && cp -r /murano/etc/murano/* /etc/murano/ \ - && chown -R murano: /etc/murano /var/log/murano /home/murano + && chown -R murano: /etc/murano /home/murano {% endif %} -RUN usermod -a -G kolla murano +COPY extend_start.sh /usr/local/bin/kolla_extend_start + +RUN usermod -a -G kolla murano \ + && chmod 755 /usr/local/bin/kolla_extend_start diff --git a/docker/murano/murano-base/extend_start.sh b/docker/murano/murano-base/extend_start.sh new file mode 100644 index 0000000000..1f94551d7f --- /dev/null +++ b/docker/murano/murano-base/extend_start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +if [[ ! -d "/var/log/kolla/murano" ]]; then + mkdir -p /var/log/kolla/murano +fi +if [[ $(stat -c %a /var/log/kolla/murano) != "755" ]]; then + chmod 755 /var/log/kolla/murano +fi