Browse Source

Merge "Add fluentd configuration for MySQL error.log"

master
Martin Polreich 6 years ago
parent
commit
176ac2e8a4
8 changed files with 77 additions and 9 deletions
  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 View File

- ``galera_xtrabackup_parallel`` - ``galera_xtrabackup_parallel``
Default is 4 Default is 4
- ``galera_error_log_enabled`` - ``galera_error_log_enabled``
Default is ``false``
Default is ``true``
- ``galera_error_log_path``
Default is ``/var/log/mysql/error.log``


Usage: Usage:


galera_wsrep_slave_threads: 8 galera_wsrep_slave_threads: 8
galera_xtrabackup_parallel: 2 galera_xtrabackup_parallel: 2
galera_error_log_enabled: true galera_error_log_enabled: true
galera_error_log_path: /var/log/mysql/error.log


Usage Usage
===== =====

+ 3
- 3
galera/files/my.cnf View File

{% endif %} {% endif %}


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


[mysqld] [mysqld]
datadir=/var/lib/mysql datadir=/var/lib/mysql
character-set-server=utf8 character-set-server=utf8
default-storage-engine=innodb default-storage-engine=innodb
{%- if service.get('error_log_enabled', False) %} {%- 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 %} {%- endif %}
skip-external-locking skip-external-locking
skip-name-resolve skip-name-resolve

+ 55
- 0
galera/meta/fluentd.yml View File

{%- 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 View File

galera_innodb_write_io_threads: 8 galera_innodb_write_io_threads: 8
galera_wsrep_slave_threads: 8 galera_wsrep_slave_threads: 8
galera_xtrabackup_parallel: 4 galera_xtrabackup_parallel: 4
galera_error_log_enabled: false
galera_error_log_enabled: true
galera_error_log_path: /var/log/mysql/error.log
galera: galera:
master: master:
enabled: true enabled: true
wsrep_slave_threads: ${_param:galera_wsrep_slave_threads} wsrep_slave_threads: ${_param:galera_wsrep_slave_threads}
xtrabackup_parallel: ${_param:galera_xtrabackup_parallel} xtrabackup_parallel: ${_param:galera_xtrabackup_parallel}
error_log_enabled: ${_param:galera_error_log_enabled} error_log_enabled: ${_param:galera_error_log_enabled}
error_log_path: ${_param:galera_error_log_path}
mysql: mysql:
server: server:
users: users:

+ 4
- 2
metadata/service/master/container.yml View File

galera_innodb_write_io_threads: 8 galera_innodb_write_io_threads: 8
galera_wsrep_slave_threads: 8 galera_wsrep_slave_threads: 8
galera_xtrabackup_parallel: 4 galera_xtrabackup_parallel: 4
galera_error_log_enabled: false
galera_error_log_enabled: true
galera_error_log_path: /var/log/mysql/error.log
kubernetes: kubernetes:
control: control:
configmap: configmap:
wsrep_slave_threads: ${_param:galera_wsrep_slave_threads} wsrep_slave_threads: ${_param:galera_wsrep_slave_threads}
xtrabackup_parallel: ${_param:galera_xtrabackup_parallel} xtrabackup_parallel: ${_param:galera_xtrabackup_parallel}
error_log_enabled: ${_param:galera_error_log_enabled} error_log_enabled: ${_param:galera_error_log_enabled}
error_log_path: ${_param:galera_error_log_path}
mysql: mysql:
server: server:
users: users:
- name: haproxy - name: haproxy
host: localhost host: localhost
- name: haproxy - name: haproxy
host: '%'
host: '%'

+ 3
- 1
metadata/service/master/single.yml View File

galera_innodb_write_io_threads: 8 galera_innodb_write_io_threads: 8
galera_wsrep_slave_threads: 8 galera_wsrep_slave_threads: 8
galera_xtrabackup_parallel: 4 galera_xtrabackup_parallel: 4
galera_error_log_enabled: false
galera_error_log_enabled: true
galera_error_log_path: /var/log/mysql/error.log
galera: galera:
master: master:
enabled: true enabled: true
wsrep_slave_threads: ${_param:galera_wsrep_slave_threads} wsrep_slave_threads: ${_param:galera_wsrep_slave_threads}
xtrabackup_parallel: ${_param:galera_xtrabackup_parallel} xtrabackup_parallel: ${_param:galera_xtrabackup_parallel}
error_log_enabled: ${_param:galera_error_log_enabled} error_log_enabled: ${_param:galera_error_log_enabled}
error_log_path: ${_param:galera_error_log_path}
mysql: mysql:
server: server:
users: users:

+ 3
- 1
metadata/service/slave/cluster.yml View File

galera_innodb_write_io_threads: 8 galera_innodb_write_io_threads: 8
galera_wsrep_slave_threads: 8 galera_wsrep_slave_threads: 8
galera_xtrabackup_parallel: 4 galera_xtrabackup_parallel: 4
galera_error_log_enabled: false
galera_error_log_enabled: true
galera_error_log_path: /var/log/mysql/error.log
galera: galera:
slave: slave:
enabled: true enabled: true
wsrep_slave_threads: ${_param:galera_wsrep_slave_threads} wsrep_slave_threads: ${_param:galera_wsrep_slave_threads}
xtrabackup_parallel: ${_param:galera_xtrabackup_parallel} xtrabackup_parallel: ${_param:galera_xtrabackup_parallel}
error_log_enabled: ${_param:galera_error_log_enabled} error_log_enabled: ${_param:galera_error_log_enabled}
error_log_path: ${_param:galera_error_log_path}
mysql: mysql:
server: server:
users: users:

+ 2
- 0
metadata/service/support.yml View File

enabled: true enabled: true
heka: heka:
enabled: true enabled: true
fluentd:
enabled: true
sensu: sensu:
enabled: false enabled: false
sphinx: sphinx:

Loading…
Cancel
Save