Saltstack Official Galera Formula
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

56 lines
2.0KB

  1. {%- if pillar.get('fluentd', {}).get('agent', {}).get('enabled', False) %}
  2. agent:
  3. config:
  4. label:
  5. mysql:
  6. input:
  7. tail_mysql:
  8. type: tail
  9. tag: mysql.log
  10. path: {{ service.get('error_log_path', '/var/log/mysql/error.log') }}
  11. pos_file: {{ pillar.fluentd.agent.dir.positiondb }}/mysql.pos
  12. parser:
  13. type: multi_format
  14. patterns:
  15. # mysql format I: https://regex101.com/r/xmjZ8H/1
  16. - type: regexp
  17. time_key: Timestamp
  18. time_format: '%F %H:%M:%S'
  19. keep_time_key: false
  20. format: '/^(?<Timestamp>.*) (?<Pid>\d+) \[(?<Severity>.*)\] (?<Payload>.*)$/'
  21. # mysql format II: https://regex101.com/r/ucqhB3/1
  22. - type: regexp
  23. time_key: Timestamp
  24. time_format: '%H:%M:%S'
  25. keep_time_key: false
  26. format: '/^(?<Pid>\d+) (?<Timestamp>.*) mysqld\_safe (?<Payload>.*)$/'
  27. filter:
  28. wsrep_severity:
  29. type: record_transformer
  30. tag: mysql.log
  31. enable_ruby: true
  32. remove_keys: priority
  33. record:
  34. - name: Severity
  35. value: '${ {"Note"=>5,"Warning"=>4,"ERROR"=>3}.fetch(record["Severity"], 6) }'
  36. mysql_record:
  37. require:
  38. - wsrep_severity
  39. type: record_transformer
  40. tag: mysql.log
  41. enable_ruby: true
  42. remove_keys: priority
  43. record:
  44. - name: service
  45. value: mysql.service
  46. - name: source
  47. value: error_log
  48. - name: severity_label
  49. value: '${ {"TRACE"=>8,"DEBUG"=>7,"INFO"=>6,"NOTICE"=>5,"WARNING"=>4,"ERROR"=>3,"CRITICAL"=>2,"ALERT"=>1,"EMERGENCY"=>0}.key(record["Severity"].to_i) }'
  50. match:
  51. push_to_default:
  52. tag: mysql.**
  53. type: relabel
  54. label: default_output
  55. {%- endif %}