From c8368995363950374601e54e34be8e88b51ee86b Mon Sep 17 00:00:00 2001 From: Sebastian Schwarz Date: Thu, 7 Aug 2014 12:50:14 +0200 Subject: [PATCH] Make error logging configurable --- README.md | 5 +++++ defaults/main.yml | 4 ++++ templates/my.cnf.j2 | 8 +++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 392569f..212ab71 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,11 @@ The MySQL users and their privileges. A user has the values `name`, `host` (defa Default MySQL connection configuration. + mysql_log_error: /var/log/mysqld.log + mysql_syslog_tag: mysqld + +MySQL logging configuration. Setting `mysql_log_error` to `syslog` will make MySQL log to syslog using the `mysql_syslog_tag`. + mysql_key_buffer_size: "256M" mysql_max_allowed_packet: "1M" mysql_table_open_cache: "256" diff --git a/defaults/main.yml b/defaults/main.yml index 7f20304..d8a19e6 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -44,6 +44,10 @@ mysql_innodb_lock_wait_timeout: 50 # mysqldump settings mysql_mysqldump_max_allowed_packet: "64M" +# mysqld_safe setting +mysql_log_error: /var/log/mysqld.log +mysql_syslog_tag: mysqld + # databases and users settings mysql_databases: [] mysql_users: [] diff --git a/templates/my.cnf.j2 b/templates/my.cnf.j2 index 13c387d..245cbc5 100644 --- a/templates/my.cnf.j2 +++ b/templates/my.cnf.j2 @@ -52,5 +52,11 @@ quick max_allowed_packet = {{ mysql_mysqldump_max_allowed_packet }} [mysqld_safe] -log-error = /var/log/mysqld.log +{% if mysql_log_error == 'syslog' %} +syslog +syslog-tag = {{ mysql_syslog_tag }} +{% else %} +skip-syslog +log-error = {{ mysql_log_error }} +{% endif %} pid-file = /var/run/mysqld/mysqld.pid