Make Heka collect RabbitMQ logs

Partially implements: blueprint heka
Change-Id: I8fd3324daf15e52712591c2b3cbec613d82b73b3
This commit is contained in:
Éric Lemoine 2016-02-03 11:58:13 +01:00 committed by Sam Yaple
parent dfe1f3bac2
commit 1ded68d2d3
6 changed files with 33 additions and 0 deletions

View File

@ -30,3 +30,4 @@
with_items: with_items:
- "global" - "global"
- "haproxy" - "haproxy"
- "rabbitmq"

View File

@ -0,0 +1,16 @@
[rabbitmq_log_decoder]
type = "SandboxDecoder"
filename = "lua_decoders/os_rabbitmq_log.lua"
[rabbitmq_log_splitter]
type = "RegexSplitter"
delimiter = '\n(=[^=]+====)'
delimiter_eol = false
[rabbitmq_logstreamer_input]
type = "LogstreamerInput"
decoder = "rabbitmq_log_decoder"
splitter = "rabbitmq_log_splitter"
log_directory = "/var/log/kolla"
file_match = 'rabbitmq/rabbit*\.log'
differentiator = ['rabbitmq']

View File

@ -12,6 +12,12 @@
"dest": "/etc/heka/heka-haproxy.toml", "dest": "/etc/heka/heka-haproxy.toml",
"owner": "heka", "owner": "heka",
"perm": "0600" "perm": "0600"
},
{
"source": "{{ container_config_directory }}/heka-rabbitmq.toml",
"dest": "/etc/heka/heka-rabbitmq.toml",
"owner": "heka",
"perm": "0600"
} }
] ]
} }

View File

@ -8,3 +8,4 @@
volumes: volumes:
- "{{ node_config_directory }}/rabbitmq/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/rabbitmq/:{{ container_config_directory }}/:ro"
- "rabbitmq:/var/lib/rabbitmq/" - "rabbitmq:/var/lib/rabbitmq/"
- "kolla_logs:/var/log/kolla/"

View File

@ -1,6 +1,8 @@
RABBITMQ_NODENAME=rabbit RABBITMQ_NODENAME=rabbit
RABBITMQ_BOOT_MODULE=rabbit_clusterer RABBITMQ_BOOT_MODULE=rabbit_clusterer
RABBITMQ_LOG_BASE=/var/log/kolla/rabbitmq
{% if not kolla_base_distro in ['ubuntu', 'debian'] %} {% if not kolla_base_distro in ['ubuntu', 'debian'] %}
RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS="-pa /usr/lib/rabbitmq/lib/rabbitmq_server-3.5.5/plugins/rabbitmq_clusterer-3.5.x-189b3a81.ez/rabbitmq_clusterer-3.5.x-189b3a81/ebin" RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS="-pa /usr/lib/rabbitmq/lib/rabbitmq_server-3.5.5/plugins/rabbitmq_clusterer-3.5.x-189b3a81.ez/rabbitmq_clusterer-3.5.x-189b3a81/ebin"
# See bug https://bugs.launchpad.net/ubuntu/+source/erlang/+bug/1374109 # See bug https://bugs.launchpad.net/ubuntu/+source/erlang/+bug/1374109

View File

@ -8,3 +8,10 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
chmod 400 /var/lib/rabbitmq/.erlang.cookie chmod 400 /var/lib/rabbitmq/.erlang.cookie
exit 0 exit 0
fi fi
if [[ ! -d "/var/log/kolla/rabbitmq" ]]; then
mkdir -p /var/log/kolla/rabbitmq
fi
if [[ $(stat -c %a /var/log/kolla/rabbitmq) != "755" ]]; then
chmod 755 /var/log/kolla/rabbitmq
fi