Configure slowlog
This commit is contained in:
parent
9fff154865
commit
88beaa611e
4 changed files with 23 additions and 0 deletions
|
@ -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
7
tasks/configuration.yml
Normal 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
|
|
@ -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
8
templates/mariadb.conf
Normal 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
|
Loading…
Reference in a new issue