Make Heka collect MariaDB logs

Partially implements: blueprint heka
Change-Id: Ib5e740683cee296bcac69228f525594850d62a27
This commit is contained in:
Éric Lemoine 2016-02-03 16:55:45 +01:00 committed by SamYaple
parent 7fb0971fb6
commit 4445c81991
7 changed files with 29 additions and 0 deletions

View File

@ -32,3 +32,4 @@
- "haproxy" - "haproxy"
- "rabbitmq" - "rabbitmq"
- "openstack" - "openstack"
- "mariadb"

View File

@ -0,0 +1,10 @@
[mariadb_log_decoder]
type = "SandboxDecoder"
filename = "lua_decoders/os_mysql_log.lua"
[mariadb_logstreamer_input]
type = "LogstreamerInput"
decoder = "mariadb_log_decoder"
log_directory = "/var/log/kolla"
file_match = 'mariadb/mariadb\.log'
differentiator = ['mariadb']

View File

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

View File

@ -51,6 +51,7 @@
volumes: volumes:
- "{{ node_config_directory }}/mariadb/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/mariadb/:{{ container_config_directory }}/:ro"
- "mariadb:/var/lib/mysql" - "mariadb:/var/lib/mysql"
- "kolla_logs:/var/log/kolla/"
when: when:
- delegate_host == 'None' - delegate_host == 'None'
- inventory_hostname == groups['mariadb'][0] - inventory_hostname == groups['mariadb'][0]

View File

@ -8,6 +8,7 @@
volumes: volumes:
- "{{ node_config_directory }}/mariadb/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/mariadb/:{{ container_config_directory }}/:ro"
- "mariadb:/var/lib/mysql" - "mariadb:/var/lib/mysql"
- "kolla_logs:/var/log/kolla/"
when: delegate_host != 'None' or when: delegate_host != 'None' or
( groups['mariadb'] | length ) == 1 or ( groups['mariadb'] | length ) == 1 or
( delegate_host == 'None' and inventory_hostname != groups['mariadb'][0] ) ( delegate_host == 'None' and inventory_hostname != groups['mariadb'][0] )

View File

@ -3,6 +3,8 @@
bind-address={{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} bind-address={{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}
port={{ mariadb_port }} port={{ mariadb_port }}
log-error=/var/log/kolla/mariadb/mariadb.log
binlog_format=ROW binlog_format=ROW
default-storage-engine=innodb default-storage-engine=innodb
innodb_autoinc_lock_mode=2 innodb_autoinc_lock_mode=2

View File

@ -23,6 +23,14 @@ if [[ $(stat -c %U:%G /var/lib/mysql) != "mysql:mysql" ]]; then
sudo chown mysql: /var/lib/mysql sudo chown mysql: /var/lib/mysql
fi fi
# Create log directory, with appropriate permissions
if [[ ! -d "/var/log/kolla/mariadb" ]]; then
mkdir -p /var/log/kolla/mariadb
fi
if [[ $(stat -c %a /var/log/kolla/mariadb) != "755" ]]; then
chmod 755 /var/log/kolla/mariadb
fi
# This catches all cases of the BOOTSTRAP variable being set, including empty # This catches all cases of the BOOTSTRAP variable being set, including empty
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]] && [[ ! -e /var/lib/mysql/cluster.exists ]]; then if [[ "${!KOLLA_BOOTSTRAP[@]}" ]] && [[ ! -e /var/lib/mysql/cluster.exists ]]; then
ARGS="--wsrep-new-cluster" ARGS="--wsrep-new-cluster"