Make Heka collect Mistral logs

Partially implements: blueprint heka

Change-Id: Ib6ac3228626360216c2c738ed601d61375b51675
This commit is contained in:
Éric Lemoine 2016-02-22 09:15:23 -08:00
parent 33fd50e603
commit a2fe38bba5
7 changed files with 30 additions and 12 deletions

View File

@ -6,5 +6,5 @@ filename = "lua_decoders/os_openstack_log.lua"
type = "LogstreamerInput" type = "LogstreamerInput"
decoder = "openstack_log_decoder" decoder = "openstack_log_decoder"
log_directory = "/var/log/kolla" log_directory = "/var/log/kolla"
file_match = '(?P<Service>nova|glance|keystone|neutron|cinder|heat|murano|magnum)/(?P<Program>.*)\.log' file_match = '(?P<Service>nova|glance|keystone|neutron|cinder|heat|murano|magnum|mistral)/(?P<Program>.*)\.log'
differentiator = ["Service", "_", "Program"] differentiator = ["Service", "_", "Program"]

View File

@ -12,6 +12,8 @@
BOOTSTRAP: BOOTSTRAP:
name: "bootstrap_mistral" name: "bootstrap_mistral"
restart_policy: "never" restart_policy: "never"
volumes: "{{ node_config_directory }}/mistral-api/:{{ container_config_directory }}/:ro" volumes:
- "{{ node_config_directory }}/mistral-api/:{{ container_config_directory }}/:ro"
- "kolla_logs:/var/log/kolla/"
run_once: True run_once: True
delegate_to: "{{ groups['mistral-api'][0] }}" delegate_to: "{{ groups['mistral-api'][0] }}"

View File

@ -7,7 +7,7 @@
image: "{{ mistral_engine_image_full }}" image: "{{ mistral_engine_image_full }}"
volumes: volumes:
- "{{ node_config_directory }}/mistral-engine/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/mistral-engine/:{{ container_config_directory }}/:ro"
- "rsyslog_socket:/var/lib/kolla/rsyslog/" - "kolla_logs:/var/log/kolla/"
when: inventory_hostname in groups['mistral-engine'] when: inventory_hostname in groups['mistral-engine']
- name: Starting mistral-executor container - name: Starting mistral-executor container
@ -18,7 +18,7 @@
image: "{{ mistral_executor_image_full }}" image: "{{ mistral_executor_image_full }}"
volumes: volumes:
- "{{ node_config_directory }}/mistral-executor/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/mistral-executor/:{{ container_config_directory }}/:ro"
- "rsyslog_socket:/var/lib/kolla/rsyslog/" - "kolla_logs:/var/log/kolla/"
when: inventory_hostname in groups['mistral-executor'] when: inventory_hostname in groups['mistral-executor']
- name: Starting mistral-api container - name: Starting mistral-api container
@ -29,5 +29,5 @@
image: "{{ mistral_api_image_full }}" image: "{{ mistral_api_image_full }}"
volumes: volumes:
- "{{ node_config_directory }}/mistral-api/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/mistral-api/:{{ container_config_directory }}/:ro"
- "rsyslog_socket:/var/lib/kolla/rsyslog/" - "kolla_logs:/var/log/kolla/"
when: inventory_hostname in groups['mistral-api'] when: inventory_hostname in groups['mistral-api']

View File

@ -1,9 +1,11 @@
[DEFAULT] [DEFAULT]
debug = {{ mistral_logging_debug }} debug = {{ mistral_logging_debug }}
log_dir = /var/log/kolla/mistral
use_syslog = True # NOTE(elemoine): set use_stderr to False or the logs will also be sent to
syslog_log_facility = LOG_LOCAL0 # stderr and collected by Docker
use_stderr = False
{% if service_name == 'mistral-api' %} {% if service_name == 'mistral-api' %}
bind_host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} bind_host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}

View File

@ -1,8 +1,8 @@
FROM {{ namespace }}/{{ image_prefix }}mistral-base:{{ tag }} FROM {{ namespace }}/{{ image_prefix }}mistral-base:{{ tag }}
MAINTAINER {{ maintainer }} MAINTAINER {{ maintainer }}
COPY extend_start.sh /usr/local/bin/kolla_extend_start COPY extend_start.sh /usr/local/bin/kolla_mistral_extend_start
RUN chmod 755 /usr/local/bin/kolla_extend_start RUN chmod 755 /usr/local/bin/kolla_mistral_extend_start
{{ include_footer }} {{ include_footer }}

View File

@ -12,10 +12,14 @@ ADD mistral-base-archive /mistral-base-source
RUN ln -s mistral-base-source/* mistral \ RUN ln -s mistral-base-source/* mistral \
&& useradd --user-group mistral \ && useradd --user-group mistral \
&& /var/lib/kolla/venv/bin/pip --no-cache-dir install /mistral \ && /var/lib/kolla/venv/bin/pip --no-cache-dir install /mistral \
&& mkdir -p /etc/mistral /var/log/mistral /home/mistral \ && mkdir -p /etc/mistral /home/mistral \
&& cp -r /mistral/etc/* /etc/mistral/ \ && cp -r /mistral/etc/* /etc/mistral/ \
&& chown -R mistral: /etc/mistral /var/log/mistral /home/mistral && chown -R mistral: /etc/mistral /home/mistral
{% endif %} {% endif %}
RUN usermod -a -G kolla mistral COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN usermod -a -G kolla mistral \
&& touch /usr/local/bin/kolla_mistral_extend_start \
&& chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_mistral_extend_start

View File

@ -0,0 +1,10 @@
#!/bin/bash
if [[ ! -d "/var/log/kolla/mistral" ]]; then
mkdir -p /var/log/kolla/mistral
fi
if [[ $(stat -c %a /var/log/kolla/mistral) != "755" ]]; then
chmod 755 /var/log/kolla/mistral
fi
source /usr/local/bin/kolla_mistral_extend_start