Make Heka collect HAProxy and Keepalived logs
Partially implements: blueprint heka Change-Id: I7e2bf4e520fa14fd40e3b329f3b2998ae6ea47f4
This commit is contained in:
parent
916925c9a8
commit
3fca4ccbaf
@ -29,3 +29,4 @@
|
|||||||
dest: "{{ node_config_directory }}/heka/heka-{{ item }}.toml"
|
dest: "{{ node_config_directory }}/heka/heka-{{ item }}.toml"
|
||||||
with_items:
|
with_items:
|
||||||
- "global"
|
- "global"
|
||||||
|
- "haproxy"
|
||||||
|
14
ansible/roles/common/templates/heka-haproxy.toml.j2
Normal file
14
ansible/roles/common/templates/heka-haproxy.toml.j2
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# HAProxy and Keepalived write their logs to Syslog, so the generic
|
||||||
|
# Syslog input set in heka-global.toml.j2 is used.
|
||||||
|
|
||||||
|
[haproxy_file_output]
|
||||||
|
type = "FileOutput"
|
||||||
|
message_matcher = "Type == 'Syslog' && Fields[programname] =~ /(?i:haproxy)/"
|
||||||
|
path = "/var/log/kolla/haproxy/haproxy.log"
|
||||||
|
encoder = "syslog_encoder"
|
||||||
|
|
||||||
|
[keepalived_file_output]
|
||||||
|
type = "FileOutput"
|
||||||
|
message_matcher = "Type == 'Syslog' && Fields[programname] =~ /(?i:keepalived)/"
|
||||||
|
path = "/var/log/kolla/haproxy/keepalived.log"
|
||||||
|
encoder = "syslog_encoder"
|
@ -6,6 +6,12 @@
|
|||||||
"dest": "/etc/heka/heka-global.toml",
|
"dest": "/etc/heka/heka-global.toml",
|
||||||
"owner": "heka",
|
"owner": "heka",
|
||||||
"perm": "0600"
|
"perm": "0600"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "{{ container_config_directory }}/heka-haproxy.toml",
|
||||||
|
"dest": "/etc/heka/heka-haproxy.toml",
|
||||||
|
"owner": "heka",
|
||||||
|
"perm": "0600"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
volumes:
|
volumes:
|
||||||
- "{{ node_config_directory }}/haproxy/:{{ container_config_directory }}/:ro"
|
- "{{ node_config_directory }}/haproxy/:{{ container_config_directory }}/:ro"
|
||||||
- "haproxy_socket:/var/lib/kolla/haproxy/"
|
- "haproxy_socket:/var/lib/kolla/haproxy/"
|
||||||
|
- "heka_socket:/var/lib/kolla/heka/"
|
||||||
|
|
||||||
- name: Starting keepalived container
|
- name: Starting keepalived container
|
||||||
kolla_docker:
|
kolla_docker:
|
||||||
@ -21,6 +22,7 @@
|
|||||||
- "{{ node_config_directory }}/keepalived/:{{ container_config_directory }}/:ro"
|
- "{{ node_config_directory }}/keepalived/:{{ container_config_directory }}/:ro"
|
||||||
- "/lib/modules:/lib/modules:ro"
|
- "/lib/modules:/lib/modules:ro"
|
||||||
- "haproxy_socket:/var/lib/kolla/haproxy/"
|
- "haproxy_socket:/var/lib/kolla/haproxy/"
|
||||||
|
- "heka_socket:/var/lib/kolla/heka/"
|
||||||
|
|
||||||
- name: Ensuring latest haproxy config is used
|
- name: Ensuring latest haproxy config is used
|
||||||
command: docker exec haproxy /usr/local/bin/kolla_ensure_haproxy_latest_config
|
command: docker exec haproxy /usr/local/bin/kolla_ensure_haproxy_latest_config
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
global
|
global
|
||||||
daemon
|
daemon
|
||||||
|
log /var/lib/kolla/heka/log local0
|
||||||
maxconn 4000
|
maxconn 4000
|
||||||
stats socket /var/lib/kolla/haproxy/haproxy.sock
|
stats socket /var/lib/kolla/haproxy/haproxy.sock
|
||||||
|
|
||||||
defaults
|
defaults
|
||||||
|
log global
|
||||||
mode http
|
mode http
|
||||||
option redispatch
|
option redispatch
|
||||||
|
option httplog
|
||||||
retries 3
|
retries 3
|
||||||
timeout http-request 10s
|
timeout http-request 10s
|
||||||
timeout queue 1m
|
timeout queue 1m
|
||||||
@ -25,6 +28,7 @@ listen stats {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']
|
|||||||
{% if enable_mariadb | bool %}
|
{% if enable_mariadb | bool %}
|
||||||
listen mariadb
|
listen mariadb
|
||||||
mode tcp
|
mode tcp
|
||||||
|
option tcplog
|
||||||
option tcpka
|
option tcpka
|
||||||
option mysql-check user haproxy
|
option mysql-check user haproxy
|
||||||
bind {{ kolla_internal_address }}:{{ mariadb_port }}
|
bind {{ kolla_internal_address }}:{{ mariadb_port }}
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# NOTE(elemoine): keepalived cannot be configured to change the log address to
|
||||||
|
# anything other than /dev/log. Heka's log socket is at /var/lib/kolla/heka/log
|
||||||
|
# so we symlink /dev/log to that location.
|
||||||
|
ln -sf /var/lib/kolla/heka/log /dev/log
|
||||||
|
|
||||||
modprobe ip_vs
|
modprobe ip_vs
|
||||||
|
|
||||||
# Workaround for bug #1485079
|
# Workaround for bug #1485079
|
||||||
|
Loading…
Reference in New Issue
Block a user