Make Heka collect Cinder logs

Partially implements: blueprint heka
Change-Id: I9dcb71a9cf063fb520fcf3485e0376f1e90d87ad
This commit is contained in:
Éric Lemoine 2016-02-12 14:17:48 +01:00 committed by SamYaple
parent 88633684a1
commit 170b493d47
8 changed files with 37 additions and 27 deletions

View File

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

View File

@ -7,7 +7,7 @@
image: "{{ cinder_api_image_full }}" image: "{{ cinder_api_image_full }}"
volumes: volumes:
- "{{ node_config_directory }}/cinder-api/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/cinder-api/:{{ container_config_directory }}/:ro"
- "rsyslog_socket:/var/lib/kolla/rsyslog/" - "kolla_logs:/var/log/kolla/"
when: inventory_hostname in groups['cinder-api'] when: inventory_hostname in groups['cinder-api']
- name: Starting cinder-scheduler container - name: Starting cinder-scheduler container
@ -18,7 +18,7 @@
image: "{{ cinder_scheduler_image_full }}" image: "{{ cinder_scheduler_image_full }}"
volumes: volumes:
- "{{ node_config_directory }}/cinder-scheduler/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/cinder-scheduler/:{{ container_config_directory }}/:ro"
- "rsyslog_socket:/var/lib/kolla/rsyslog/" - "kolla_logs:/var/log/kolla/"
when: inventory_hostname in groups['cinder-scheduler'] when: inventory_hostname in groups['cinder-scheduler']
- name: Starting cinder-volume container - name: Starting cinder-volume container
@ -32,7 +32,7 @@
- "{{ node_config_directory }}/cinder-volume/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/cinder-volume/:{{ container_config_directory }}/:ro"
- "/dev/:/dev/" - "/dev/:/dev/"
- "/run/:/run/" - "/run/:/run/"
- "rsyslog_socket:/var/lib/kolla/rsyslog/" - "kolla_logs:/var/log/kolla/"
when: inventory_hostname in groups['cinder-volume'] when: inventory_hostname in groups['cinder-volume']
- name: Starting cinder-backup container - name: Starting cinder-backup container
@ -44,6 +44,6 @@
privileged: True privileged: True
volumes: volumes:
- "{{ node_config_directory }}/cinder-backup/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/cinder-backup/:{{ container_config_directory }}/:ro"
- "/run/kolla/log:/dev/log"
- "/dev/mapper/:/dev/mapper/" - "/dev/mapper/:/dev/mapper/"
- "kolla_logs:/var/log/kolla/"
when: inventory_hostname in groups['cinder-backup'] when: inventory_hostname in groups['cinder-backup']

View File

@ -1,8 +1,11 @@
[DEFAULT] [DEFAULT]
debug = {{ cinder_logging_debug }} debug = {{ cinder_logging_debug }}
use_syslog = True log_dir = /var/log/kolla/cinder
syslog_log_facility = LOG_LOCAL0
# Set use_stderr to False or the logs will also be sent to stderr
# and collected by Docker
use_stderr = False
enable_v1_api=false enable_v1_api=false
volume_name_template = %s volume_name_template = %s

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)/(?P<Program>.*)\.log' file_match = '(?P<Service>nova|glance|keystone|neutron|cinder)/(?P<Program>.*)\.log'
differentiator = ["Service", "_", "Program"] differentiator = ["Service", "_", "Program"]

View File

@ -16,18 +16,6 @@ $template HeatAPICfnFile,"/var/log/heat/heat-api-cfn.log"
$template HeatEngineFile,"/var/log/heat/heat-engine.log" $template HeatEngineFile,"/var/log/heat/heat-engine.log"
:syslogtag,contains,"heat-engine" ?HeatEngineFile :syslogtag,contains,"heat-engine" ?HeatEngineFile
$template CinderApiFile,"/var/log/cinder/cinder-api.log"
:syslogtag,contains,"cinder-api" ?CinderApiFile
$template CinderBackupFile,"/var/log/cinder/cinder-backup.log"
:syslogtag,contains,"cinder-backup" ?CinderBackupFile
$template CinderSchedulerFile,"/var/log/cinder/cinder-scheduler.log"
:syslogtag,contains,"cinder-scheduler" ?CinderSchedulerFile
$template CinderVolumeFile,"/var/log/cinder/cinder-volume.log"
:syslogtag,contains,"cinder-volume" ?CinderVolumeFile
$template MuranoEngineFile,"/var/log/murano/murano-engine.log" $template MuranoEngineFile,"/var/log/murano/murano-engine.log"
:syslogtag,contains,"murano-engine" ?MuranoEngineFile :syslogtag,contains,"murano-engine" ?MuranoEngineFile

View File

@ -1,6 +1,13 @@
#!/bin/bash #!/bin/bash
set -o errexit set -o errexit
if [[ ! -d "/var/log/kolla/cinder" ]]; then
mkdir -p /var/log/kolla/cinder
fi
if [[ $(stat -c %a /var/log/kolla/cinder) != "755" ]]; then
chmod 755 /var/log/kolla/cinder
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

@ -45,15 +45,17 @@ ADD cinder-base-archive /cinder-base-source
RUN ln -s cinder-base-source/* cinder \ RUN ln -s cinder-base-source/* cinder \
&& useradd --user-group cinder \ && useradd --user-group cinder \
&& /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt /cinder \ && /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt /cinder \
&& mkdir -p /etc/cinder /var/log/cinder /var/lib/cinder /home/cinder \ && mkdir -p /etc/cinder /var/lib/cinder /home/cinder \
&& cp -r /cinder/etc/cinder/* /etc/cinder/ \ && cp -r /cinder/etc/cinder/* /etc/cinder/ \
&& chown -R cinder: /etc/cinder /var/log/cinder /var/lib/cinder /home/cinder \ && chown -R cinder: /etc/cinder /var/lib/cinder /home/cinder \
&& sed -i 's|^exec_dirs.*|exec_dirs=/var/lib/kolla/venv/bin,/sbin,/usr/sbin,/bin,/usr/bin,/usr/local/bin,/usr/local/sbin|g' /etc/cinder/rootwrap.conf && sed -i 's|^exec_dirs.*|exec_dirs=/var/lib/kolla/venv/bin,/sbin,/usr/sbin,/bin,/usr/bin,/usr/local/bin,/usr/local/sbin|g' /etc/cinder/rootwrap.conf
COPY cinder_sudoers /etc/sudoers.d/cinder_sudoers
RUN chmod 750 /etc/sudoers.d \
&& chmod 440 /etc/sudoers.d/cinder_sudoers
{% endif %} {% endif %}
RUN usermod -a -G kolla cinder COPY cinder_sudoers /etc/sudoers.d/cinder_sudoers
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN usermod -a -G kolla cinder \
&& chmod 750 /etc/sudoers.d \
&& chmod 440 /etc/sudoers.d/cinder_sudoers \
&& chmod 755 /usr/local/bin/kolla_extend_start

View File

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