From 390e97ca7c44e9a9e91f02eabfe544d74c2ecbcd Mon Sep 17 00:00:00 2001 From: Dave Wilde Date: Wed, 6 May 2015 16:03:14 -0500 Subject: [PATCH] Move Galera logs to /var/log/mysql_logs and set correct ownership By default the permissions on the Galera log files are too restrictive for rsyslog to read. This patch moves those files to /var/log/mysql_log and gives it group ownership of syslog. Further it sets the sticky bit on /var/log/mysql_log and ensures that the syslog group has read access. Change-Id: I57403a4147a07f949c78e648357070e23fe6d47f Closes-bug: 1452316 --- playbooks/galera-install.yml | 2 +- playbooks/roles/galera_server/tasks/galera_post_install.yml | 1 + playbooks/roles/galera_server/templates/my.cnf.j2 | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/playbooks/galera-install.yml b/playbooks/galera-install.yml index 753550e6f2..a06b9a682c 100644 --- a/playbooks/galera-install.yml +++ b/playbooks/galera-install.yml @@ -45,7 +45,7 @@ roles: - { role: "galera_server", tags: [ "galera-server" ] } - role: "rsyslog_client" - rsyslog_client_log_dir: "/var/log/mysql" + rsyslog_client_log_dir: "/var/log/mysql_logs" rsyslog_client_log_files: - /var/log/mysql.log - /var/log/mysql.err diff --git a/playbooks/roles/galera_server/tasks/galera_post_install.yml b/playbooks/roles/galera_server/tasks/galera_post_install.yml index 642f5649d7..89d2462fae 100644 --- a/playbooks/roles/galera_server/tasks/galera_post_install.yml +++ b/playbooks/roles/galera_server/tasks/galera_post_install.yml @@ -23,6 +23,7 @@ recurse: "{{ item.recurse|default('false') }}" with_items: - { path: "/var/log/mysql/", owner: "mysql", recurse: "true" } + - { path: "/var/log/mysql_logs/", owner: "mysql", group: "syslog", mode: "2755" } - { path: "/etc/mysql/conf.d" } tags: - galera-config diff --git a/playbooks/roles/galera_server/templates/my.cnf.j2 b/playbooks/roles/galera_server/templates/my.cnf.j2 index 6c4589f7ee..cc53f82b7f 100644 --- a/playbooks/roles/galera_server/templates/my.cnf.j2 +++ b/playbooks/roles/galera_server/templates/my.cnf.j2 @@ -32,8 +32,8 @@ datadir = /var/lib/mysql # LOGGING # log-queries-not-using-indexes = 1 slow-query-log = 1 -slow-query-log-file = /var/log/mysql/mysql-slow.log -log_error = /var/log/mysql/galera_server_error.log +slow-query-log-file = /var/log/mysql_logs/mysql-slow.log +log_error = /var/log/mysql_logs/galera_server_error.log log-bin = /var/lib/mysql/mariadb-bin log-bin-index = /var/lib/mysql/mariadb-bin.index expire-logs-days = 7