Make Heka collect Glance logs

Partially implements: blueprint heka
Change-Id: I9e5ba649bc45356822138ad223430f4b93722448
This commit is contained in:
Éric Lemoine 2016-02-05 15:38:55 +01:00 committed by SamYaple
parent 4445c81991
commit 5de471f61e
9 changed files with 30 additions and 18 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)/(?P<Program>.*)\.log' file_match = '(?P<Service>nova|glance)/(?P<Program>.*)\.log'
differentiator = ["Service", "_", "Program"] differentiator = ["Service", "_", "Program"]

View File

@ -10,12 +10,6 @@ $RepeatedMsgReduction on
$template KollaToolboxFile,"/var/log/kolla_toolbox.log" $template KollaToolboxFile,"/var/log/kolla_toolbox.log"
:syslogtag,contains,"toolbox" ?KollaToolboxFile :syslogtag,contains,"toolbox" ?KollaToolboxFile
$template GlanceApiFile,"/var/log/glance/glance_api.log"
:syslogtag,contains,"glance-api" ?GlanceApiFile
$template GlanceRegistryFile,"/var/log/glance/glance_registry.log"
:syslogtag,contains,"glance-registry" ?GlanceRegistryFile
$template HeatAPIFile,"/var/log/heat/heat-api.log" $template HeatAPIFile,"/var/log/heat/heat-api.log"
:syslogtag,contains,"heat-api" ?HeatAPIFile :syslogtag,contains,"heat-api" ?HeatAPIFile

View File

@ -52,6 +52,7 @@
volumes: volumes:
- "{{ node_config_directory }}/glance-api/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/glance-api/:{{ container_config_directory }}/:ro"
- "glance:/var/lib/glance/" - "glance:/var/lib/glance/"
- "kolla_logs:/var/log/kolla/"
run_once: True run_once: True
delegate_to: "{{ groups['glance-api'][0] }}" delegate_to: "{{ groups['glance-api'][0] }}"
when: database_created when: database_created

View File

@ -7,7 +7,7 @@
name: "glance_registry" name: "glance_registry"
volumes: volumes:
- "{{ node_config_directory }}/glance-registry/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/glance-registry/:{{ container_config_directory }}/:ro"
- "rsyslog_socket:/var/lib/kolla/rsyslog/" - "kolla_logs:/var/log/kolla/"
when: inventory_hostname in groups['glance-registry'] when: inventory_hostname in groups['glance-registry']
- name: Starting glance-api container - name: Starting glance-api container
@ -19,5 +19,5 @@
volumes: volumes:
- "{{ node_config_directory }}/glance-api/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/glance-api/:{{ container_config_directory }}/:ro"
- "glance:/var/lib/glance/" - "glance:/var/lib/glance/"
- "rsyslog_socket:/var/lib/kolla/rsyslog/" - "kolla_logs:/var/log/kolla/"
when: inventory_hostname in groups['glance-api'] when: inventory_hostname in groups['glance-api']

View File

@ -1,15 +1,15 @@
[DEFAULT] [DEFAULT]
debug = {{ glance_logging_debug }} debug = {{ glance_logging_debug }}
# NOTE(elemoine) log_dir alone does not work for Glance
log_file = /var/log/kolla/glance/api.log
bind_host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} bind_host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}
bind_port = {{ glance_api_port }} bind_port = {{ glance_api_port }}
registry_host = {{ kolla_internal_address }} registry_host = {{ kolla_internal_address }}
use_syslog = True
syslog_log_facility = LOG_LOCAL0
{% if enable_ceph | bool %} {% if enable_ceph | bool %}
show_image_direct_url= True show_image_direct_url= True
{% endif %} {% endif %}

View File

@ -1,13 +1,13 @@
[DEFAULT] [DEFAULT]
debug = {{ glance_logging_debug }} debug = {{ glance_logging_debug }}
# NOTE(elemoine) log_dir alone does not work for Glance
log_file = /var/log/kolla/glance/registry.log
bind_host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} bind_host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}
bind_port = {{ glance_registry_port }} bind_port = {{ glance_registry_port }}
use_syslog = True
syslog_log_facility = LOG_LOCAL0
[database] [database]
connection = mysql+pymysql://{{ glance_database_user }}:{{ glance_database_password }}@{{ glance_database_address }}/{{ glance_database_name }} connection = mysql+pymysql://{{ glance_database_user }}:{{ glance_database_password }}@{{ glance_database_address }}/{{ glance_database_name }}

View File

@ -1,5 +1,12 @@
#!/bin/bash #!/bin/bash
if [[ ! -d "/var/log/kolla/glance" ]]; then
mkdir -p /var/log/kolla/glance
fi
if [[ $(stat -c %a /var/log/kolla/glance) != "755" ]]; then
chmod 755 /var/log/kolla/glance
fi
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases # Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty. # of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then

View File

@ -44,14 +44,16 @@ ADD glance-base-archive /glance-base-source
RUN ln -s glance-base-source/* glance \ RUN ln -s glance-base-source/* glance \
&& useradd --user-group glance \ && useradd --user-group glance \
&& /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt /glance \ && /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt /glance \
&& mkdir -p /etc/glance /var/log/glance /var/lib/glance /home/glance \ && mkdir -p /etc/glance /var/lib/glance /home/glance \
&& cp -r /glance/etc/* /etc/glance/ \ && cp -r /glance/etc/* /etc/glance/ \
&& chown -R glance: /etc/glance /var/log/glance /var/lib/glance /home/glance && chown -R glance: /etc/glance /var/lib/glance /home/glance
{% endif %} {% endif %}
COPY glance_sudoers /etc/sudoers.d/glance_sudoers COPY glance_sudoers /etc/sudoers.d/glance_sudoers
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN usermod -a -G kolla glance \ RUN usermod -a -G kolla glance \
&& chmod 750 /etc/sudoers.d \ && chmod 750 /etc/sudoers.d \
&& chmod 440 /etc/sudoers.d/glance_sudoers && chmod 440 /etc/sudoers.d/glance_sudoers \
&& chmod 755 /usr/local/bin/kolla_extend_start

View File

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