From 1a2fe93a95567937e0622d612f04953590e6ed41 Mon Sep 17 00:00:00 2001 From: Mauricio Lima Date: Tue, 3 May 2016 15:47:41 -0400 Subject: [PATCH] Make Heka collect Ceph logs Change-Id: Ibaa5f8ba600afafa111d2ef204ee9192b8babdfc Closes-Bug: #1570529 --- ansible/roles/ceph/tasks/bootstrap_osds.yml | 2 ++ ansible/roles/ceph/tasks/generate_cluster.yml | 1 + ansible/roles/ceph/tasks/start_mons.yml | 1 + ansible/roles/ceph/tasks/start_osds.yml | 1 + ansible/roles/ceph/tasks/start_rgws.yml | 1 + ansible/roles/ceph/templates/ceph.conf.j2 | 6 +++++- ansible/roles/common/templates/heka-openstack.toml.j2 | 2 +- docker/ceph/ceph-base/Dockerfile.j2 | 3 +++ docker/ceph/ceph-base/extend_start.sh | 8 ++++++++ docker/ceph/ceph-mon/extend_start.sh | 7 +++++++ docker/ceph/ceph-osd/extend_start.sh | 7 +++++++ 11 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 docker/ceph/ceph-base/extend_start.sh diff --git a/ansible/roles/ceph/tasks/bootstrap_osds.yml b/ansible/roles/ceph/tasks/bootstrap_osds.yml index c3dfac0c50..b4970b88c3 100644 --- a/ansible/roles/ceph/tasks/bootstrap_osds.yml +++ b/ansible/roles/ceph/tasks/bootstrap_osds.yml @@ -51,6 +51,7 @@ - "{{ node_config_directory }}/ceph-osd/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "/dev/:/dev/" + - "kolla_logs:/var/log/kolla/" with_indexed_items: osds_bootstrap|default([]) - name: Bootstrapping Ceph Cache OSDs @@ -82,4 +83,5 @@ - "{{ node_config_directory }}/ceph-osd/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "/dev/:/dev/" + - "kolla_logs:/var/log/kolla/" with_indexed_items: osds_cache_bootstrap|default([]) diff --git a/ansible/roles/ceph/tasks/generate_cluster.yml b/ansible/roles/ceph/tasks/generate_cluster.yml index 4c085b9991..77ac8dc94f 100644 --- a/ansible/roles/ceph/tasks/generate_cluster.yml +++ b/ansible/roles/ceph/tasks/generate_cluster.yml @@ -19,6 +19,7 @@ - "/etc/localtime:/etc/localtime:ro" - "ceph_mon:/var/lib/ceph" - "ceph_mon_config:/etc/ceph" + - "kolla_logs:/var/log/kolla/" - include: start_mons.yml diff --git a/ansible/roles/ceph/tasks/start_mons.yml b/ansible/roles/ceph/tasks/start_mons.yml index 6ff67f95aa..ccc2467bf6 100644 --- a/ansible/roles/ceph/tasks/start_mons.yml +++ b/ansible/roles/ceph/tasks/start_mons.yml @@ -13,3 +13,4 @@ - "/etc/localtime:/etc/localtime:ro" - "ceph_mon:/var/lib/ceph" - "ceph_mon_config:/etc/ceph" + - "kolla_logs:/var/log/kolla/" diff --git a/ansible/roles/ceph/tasks/start_osds.yml b/ansible/roles/ceph/tasks/start_osds.yml index 9c0e66bcd2..be86c38cef 100644 --- a/ansible/roles/ceph/tasks/start_osds.yml +++ b/ansible/roles/ceph/tasks/start_osds.yml @@ -44,6 +44,7 @@ - "/etc/localtime:/etc/localtime:ro" - "/dev/:/dev/" - "/var/lib/ceph/osd/{{ item.1['fs_uuid'] }}:/var/lib/ceph/osd/ceph-{{ item.0.stdout }}" + - "kolla_logs:/var/log/kolla/" with_together: - id.results - osds diff --git a/ansible/roles/ceph/tasks/start_rgws.yml b/ansible/roles/ceph/tasks/start_rgws.yml index f8cc73359f..22ad1d2133 100644 --- a/ansible/roles/ceph/tasks/start_rgws.yml +++ b/ansible/roles/ceph/tasks/start_rgws.yml @@ -8,3 +8,4 @@ volumes: - "{{ node_config_directory }}/ceph-rgw/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" + - "kolla_logs:/var/log/kolla/" diff --git a/ansible/roles/ceph/templates/ceph.conf.j2 b/ansible/roles/ceph/templates/ceph.conf.j2 index 9c669b9f92..12a6b37376 100644 --- a/ansible/roles/ceph/templates/ceph.conf.j2 +++ b/ansible/roles/ceph/templates/ceph.conf.j2 @@ -1,4 +1,8 @@ [global] +log file = /var/log/kolla/ceph/$cluster-$name.log +log to syslog = true +err to syslog = true + fsid = {{ ceph_cluster_fsid }} mon initial members = {% for host in groups['ceph-mon'] %}{{ hostvars[host]['ansible_' + hostvars[host]['storage_interface']]['ipv4']['address'] }}{% if not loop.last %}, {% endif %}{% endfor %} @@ -19,6 +23,6 @@ mon compact on start = true [client.radosgw.gateway] host = {{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }} keyring = /etc/ceph/ceph.client.radosgw.keyring -log file = /var/log/radosgw/client.radosgw.gateway.log +log file = /var/log/kolla/ceph/client.radosgw.gateway.log rgw frontends = civetweb port={{ rgw_port }} {% endif %} diff --git a/ansible/roles/common/templates/heka-openstack.toml.j2 b/ansible/roles/common/templates/heka-openstack.toml.j2 index 9cf3782db5..65cfcf1124 100644 --- a/ansible/roles/common/templates/heka-openstack.toml.j2 +++ b/ansible/roles/common/templates/heka-openstack.toml.j2 @@ -6,6 +6,6 @@ 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|murano|magnum|mistral|manila)/(?P.*)\.log\.?(?P\d*)$' +file_match = '(?Pnova|glance|keystone|neutron|ceph|cinder|heat|murano|magnum|mistral|manila)/(?P.*)\.log\.?(?P\d*)$' priority = ["^Seq"] differentiator = ["Service", "_", "Program"] diff --git a/docker/ceph/ceph-base/Dockerfile.j2 b/docker/ceph/ceph-base/Dockerfile.j2 index 4787448f86..c71319dfd9 100644 --- a/docker/ceph/ceph-base/Dockerfile.j2 +++ b/docker/ceph/ceph-base/Dockerfile.j2 @@ -23,6 +23,9 @@ RUN apt-get install -y --no-install-recommends \ {% endif %} +COPY extend_start.sh /usr/local/bin/kolla_extend_start +RUN chmod 755 /usr/local/bin/kolla_extend_start + RUN useradd --user-group ceph \ && mkdir -p /home/ceph \ && chown -R ceph: /home/ceph diff --git a/docker/ceph/ceph-base/extend_start.sh b/docker/ceph/ceph-base/extend_start.sh new file mode 100644 index 0000000000..968be09809 --- /dev/null +++ b/docker/ceph/ceph-base/extend_start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +if [[ ! -d "/var/log/kolla/ceph" ]]; then + mkdir -p /var/log/kolla/ceph +fi +if [[ $(stat -c %a /var/log/kolla/ceph) != "755" ]]; then + chmod 755 /var/log/kolla/ceph +fi diff --git a/docker/ceph/ceph-mon/extend_start.sh b/docker/ceph/ceph-mon/extend_start.sh index 8d43c0e3b6..30ffba5fc4 100644 --- a/docker/ceph/ceph-mon/extend_start.sh +++ b/docker/ceph/ceph-mon/extend_start.sh @@ -7,6 +7,13 @@ KEYRING_RGW="/etc/ceph/ceph.client.radosgw.keyring" MONMAP="/etc/ceph/ceph.monmap" MON_DIR="/var/lib/ceph/mon/ceph-${HOSTNAME}" +if [[ ! -d "/var/log/kolla/ceph" ]]; then + mkdir -p /var/log/kolla/ceph +fi +if [[ $(stat -c %a /var/log/kolla/ceph) != "755" ]]; then + chmod 755 /var/log/kolla/ceph +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/ceph/ceph-osd/extend_start.sh b/docker/ceph/ceph-osd/extend_start.sh index 97119578a7..733e45ff91 100644 --- a/docker/ceph/ceph-osd/extend_start.sh +++ b/docker/ceph/ceph-osd/extend_start.sh @@ -1,5 +1,12 @@ #!/bin/bash +if [[ ! -d "/var/log/kolla/ceph" ]]; then + mkdir -p /var/log/kolla/ceph +fi +if [[ $(stat -c %a /var/log/kolla/ceph) != "755" ]]; then + chmod 755 /var/log/kolla/ceph +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