From a5afa45f4eecec48a888a54ceeff57b680d733e1 Mon Sep 17 00:00:00 2001 From: Jeffrey Zhang Date: Sun, 16 Oct 2016 08:00:04 +0800 Subject: [PATCH] Configure log path for kibana Closes-Bug: #1635989 Change-Id: I99402e54e7cc2f1ad972021bb1056966f5c08bff --- ansible/roles/kibana/templates/kibana.yml.j2 | 1 + docker/kibana/Dockerfile.j2 | 4 +++- docker/kibana/extend_start.sh | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 docker/kibana/extend_start.sh diff --git a/ansible/roles/kibana/templates/kibana.yml.j2 b/ansible/roles/kibana/templates/kibana.yml.j2 index 7d9fcbe149..9d161b0fbe 100644 --- a/ansible/roles/kibana/templates/kibana.yml.j2 +++ b/ansible/roles/kibana/templates/kibana.yml.j2 @@ -1,4 +1,5 @@ kibana.defaultAppId: "{{ kibana_default_app_id }}" +logging.dest: /var/log/kolla/kibana/kibana.log server.port: {{ kibana_server_port }} server.host: "{% if orchestration_engine == 'KUBERNETES' %}0.0.0.0{% else %}{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}{% endif %}" elasticsearch.url: "{{ internal_protocol }}://{% if orchestration_engine == 'KUBERNETES' %}elasticsearch{% else %}{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}{% endif %}:{{ elasticsearch_port }}" diff --git a/docker/kibana/Dockerfile.j2 b/docker/kibana/Dockerfile.j2 index 9ea010a73f..a41c86d859 100644 --- a/docker/kibana/Dockerfile.j2 +++ b/docker/kibana/Dockerfile.j2 @@ -5,8 +5,10 @@ MAINTAINER {{ maintainer }} {% import "macros.j2" as macros with context %} +COPY extend_start.sh /usr/local/bin/kolla_extend_start RUN useradd -r -m --user-group kibana \ - && usermod -a -G kolla kibana + && usermod -a -G kolla kibana \ + && chmod 755 /usr/local/bin/kolla_extend_start {% set kibana_packages = ['kibana'] %} {{ macros.install_packages(kibana_packages | customizable("packages")) }} diff --git a/docker/kibana/extend_start.sh b/docker/kibana/extend_start.sh new file mode 100644 index 0000000000..4f6143181a --- /dev/null +++ b/docker/kibana/extend_start.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +KIBANA_LOG_DIR="/var/log/kolla/kibana" + +if [[ ! -d "${KIBANA_LOG_DIR}" ]]; then + mkdir -p "${KIBANA_LOG_DIR}" +fi +if [[ $(stat -c %U:%G "${KIBANA_LOG_DIR}") != "kibana:kolla" ]]; then + chown kibana:kolla "${KIBANA_LOG_DIR}" +fi