Configure slowlog

This commit is contained in:
phil 2023-02-15 19:36:00 +01:00
parent 9fff154865
commit 88beaa611e
4 changed files with 23 additions and 0 deletions

View file

@ -6,3 +6,7 @@ munin_sql_user: munin
munin_sql_password: "{{ lookup('ansible.builtin.password', '/dev/null chars=ascii_lowercase,digits length=23') }}" munin_sql_password: "{{ lookup('ansible.builtin.password', '/dev/null chars=ascii_lowercase,digits length=23') }}"
mysql_socket: /run/mysqld/mysqld.sock mysql_socket: /run/mysqld/mysqld.sock
slowlog_query_log_file: /var/log/mysql/mariadb-slow.logA
slowlog_query_time: 10
slowlog_log_slow_rate_limit: 1000

7
tasks/configuration.yml Normal file
View file

@ -0,0 +1,7 @@
---
- name: Configuration | Copy configuration file
ansible.builtin.template:
src: mariadb.conf
dest: "/etc/mysql/mariadb.conf.d/90-{{ ansible_hostname }}.cnf"
mode: 0644
notify: restart mariadb

View file

@ -20,3 +20,7 @@
ansible.builtin.import_tasks: monit.yml ansible.builtin.import_tasks: monit.yml
when: "'monit' in ansible_facts.packages" when: "'monit' in ansible_facts.packages"
tags: monit tags: monit
- name: Configuration
ansible.builtin.import_tasks: configuration.yml
tags: configuration

8
templates/mariadb.conf Normal file
View file

@ -0,0 +1,8 @@
# Ansible managed
# slow log
slow_query_log = 1
slow_query_log_file = {{ slowlog_query_log_file }}
long_query_time = {{ slowlog_query_time }}
log_slow_rate_limit = {{ slowlog_log_slow_rate_limit }}
log_slow_verbosity = query_plan