Переглянути джерело

Merge "Add fluentd configuration for MySQL error.log"

master
Martin Polreich 6 роки тому
джерело
коміт
176ac2e8a4
8 змінених файлів з 77 додано та 9 видалено
  1. +4
    -1
      README.rst
  2. +3
    -3
      galera/files/my.cnf
  3. +55
    -0
      galera/meta/fluentd.yml
  4. +3
    -1
      metadata/service/master/cluster.yml
  5. +4
    -2
      metadata/service/master/container.yml
  6. +3
    -1
      metadata/service/master/single.yml
  7. +3
    -1
      metadata/service/slave/cluster.yml
  8. +2
    -0
      metadata/service/support.yml

+ 4
- 1
README.rst Переглянути файл

@@ -164,7 +164,9 @@ Configurable soft parameters
- ``galera_xtrabackup_parallel``
Default is 4
- ``galera_error_log_enabled``
Default is ``false``
Default is ``true``
- ``galera_error_log_path``
Default is ``/var/log/mysql/error.log``

Usage:

@@ -178,6 +180,7 @@ Usage:
galera_wsrep_slave_threads: 8
galera_xtrabackup_parallel: 2
galera_error_log_enabled: true
galera_error_log_path: /var/log/mysql/error.log

Usage
=====

+ 3
- 3
galera/files/my.cnf Переглянути файл

@@ -18,7 +18,9 @@ ssl-key={{ service.ssl.key_file }}
{% endif %}

[mysqld_safe]
{%- if not service.get('error_log_enabled', False) %}
syslog
{%- endif %}

[mysqld]
datadir=/var/lib/mysql
@@ -32,9 +34,7 @@ init-connect='SET NAMES utf8'
character-set-server=utf8
default-storage-engine=innodb
{%- if service.get('error_log_enabled', False) %}
log_error = /var/log/mysql/error.log
{%- else %}
#log_error = /var/log/mysql/error.log
log_error = {{ service.get('error_log_path', '/var/log/mysql/error.log') }}
{%- endif %}
skip-external-locking
skip-name-resolve

+ 55
- 0
galera/meta/fluentd.yml Переглянути файл

@@ -0,0 +1,55 @@
{%- if pillar.get('fluentd', {}).get('agent', {}).get('enabled', False) %}
agent:
config:
label:
mysql:
input:
tail_mysql:
type: tail
tag: mysql.log
path: {{ service.get('error_log_path', '/var/log/mysql/error.log') }}
pos_file: {{ pillar.fluentd.agent.dir.positiondb }}/mysql.pos
parser:
type: multi_format
patterns:
# mysql format I: https://regex101.com/r/xmjZ8H/1
- type: regexp
time_key: Timestamp
time_format: '%F %H:%M:%S'
keep_time_key: false
format: '/^(?<Timestamp>.*) (?<Pid>\d+) \[(?<Severity>.*)\] (?<Payload>.*)$/'
# mysql format II: https://regex101.com/r/ucqhB3/1
- type: regexp
time_key: Timestamp
time_format: '%H:%M:%S'
keep_time_key: false
format: '/^(?<Pid>\d+) (?<Timestamp>.*) mysqld\_safe (?<Payload>.*)$/'
filter:
wsrep_severity:
type: record_transformer
tag: mysql.log
enable_ruby: true
remove_keys: priority
record:
- name: Severity
value: '${ {"Note"=>5,"Warning"=>4,"ERROR"=>3}.fetch(record["Severity"], 6) }'
mysql_record:
require:
- wsrep_severity
type: record_transformer
tag: mysql.log
enable_ruby: true
remove_keys: priority
record:
- name: service
value: mysql.service
- name: source
value: error_log
- name: severity_label
value: '${ {"TRACE"=>8,"DEBUG"=>7,"INFO"=>6,"NOTICE"=>5,"WARNING"=>4,"ERROR"=>3,"CRITICAL"=>2,"ALERT"=>1,"EMERGENCY"=>0}.key(record["Severity"].to_i) }'
match:
push_to_default:
tag: mysql.**
type: relabel
label: default_output
{%- endif %}

+ 3
- 1
metadata/service/master/cluster.yml Переглянути файл

@@ -14,7 +14,8 @@ parameters:
galera_innodb_write_io_threads: 8
galera_wsrep_slave_threads: 8
galera_xtrabackup_parallel: 4
galera_error_log_enabled: false
galera_error_log_enabled: true
galera_error_log_path: /var/log/mysql/error.log
galera:
master:
enabled: true
@@ -40,6 +41,7 @@ parameters:
wsrep_slave_threads: ${_param:galera_wsrep_slave_threads}
xtrabackup_parallel: ${_param:galera_xtrabackup_parallel}
error_log_enabled: ${_param:galera_error_log_enabled}
error_log_path: ${_param:galera_error_log_path}
mysql:
server:
users:

+ 4
- 2
metadata/service/master/container.yml Переглянути файл

@@ -9,7 +9,8 @@ parameters:
galera_innodb_write_io_threads: 8
galera_wsrep_slave_threads: 8
galera_xtrabackup_parallel: 4
galera_error_log_enabled: false
galera_error_log_enabled: true
galera_error_log_path: /var/log/mysql/error.log
kubernetes:
control:
configmap:
@@ -42,10 +43,11 @@ parameters:
wsrep_slave_threads: ${_param:galera_wsrep_slave_threads}
xtrabackup_parallel: ${_param:galera_xtrabackup_parallel}
error_log_enabled: ${_param:galera_error_log_enabled}
error_log_path: ${_param:galera_error_log_path}
mysql:
server:
users:
- name: haproxy
host: localhost
- name: haproxy
host: '%'
host: '%'

+ 3
- 1
metadata/service/master/single.yml Переглянути файл

@@ -14,7 +14,8 @@ parameters:
galera_innodb_write_io_threads: 8
galera_wsrep_slave_threads: 8
galera_xtrabackup_parallel: 4
galera_error_log_enabled: false
galera_error_log_enabled: true
galera_error_log_path: /var/log/mysql/error.log
galera:
master:
enabled: true
@@ -36,6 +37,7 @@ parameters:
wsrep_slave_threads: ${_param:galera_wsrep_slave_threads}
xtrabackup_parallel: ${_param:galera_xtrabackup_parallel}
error_log_enabled: ${_param:galera_error_log_enabled}
error_log_path: ${_param:galera_error_log_path}
mysql:
server:
users:

+ 3
- 1
metadata/service/slave/cluster.yml Переглянути файл

@@ -14,7 +14,8 @@ parameters:
galera_innodb_write_io_threads: 8
galera_wsrep_slave_threads: 8
galera_xtrabackup_parallel: 4
galera_error_log_enabled: false
galera_error_log_enabled: true
galera_error_log_path: /var/log/mysql/error.log
galera:
slave:
enabled: true
@@ -40,6 +41,7 @@ parameters:
wsrep_slave_threads: ${_param:galera_wsrep_slave_threads}
xtrabackup_parallel: ${_param:galera_xtrabackup_parallel}
error_log_enabled: ${_param:galera_error_log_enabled}
error_log_path: ${_param:galera_error_log_path}
mysql:
server:
users:

+ 2
- 0
metadata/service/support.yml Переглянути файл

@@ -5,6 +5,8 @@ parameters:
enabled: true
heka:
enabled: true
fluentd:
enabled: true
sensu:
enabled: false
sphinx:

Завантаження…
Відмінити
Зберегти