8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

8.4.5 MySQL 企业审核8.4.5 MySQL Enterprise Audit

Note

MySQL Enterprise Audit 是包含在 MySQL 企业版中的一个扩展商业产品。要了解更多关于商业产品的信息,请参见 https://www.mysql.com/products/。MySQL Enterprise Audit is an extension included in MySQL Enterprise Edition, a commercial product. To learn more about commercial products, see https://www.mysql.com/products/.

MySQL 企业版包括通过名为 audit_log 的服务器插件实现的 MySQL Enterprise Audit。MySQL Enterprise Audit 使用开放的 MySQL 审计 API,使得能够基于标准和策略对在特定 MySQL 服务器上执行的连接和查询活动进行监控、记录和阻止。MySQL Enterprise Audit 旨在满足 Oracle 审计规范,为受内部和外部监管指南管理的应用程序提供开箱即用、易于使用的审计和合规解决方案。MySQL Enterprise Edition includes MySQL Enterprise Audit, implemented using a server plugin named audit_log. MySQL Enterprise Audit uses the open MySQL Audit API to enable standard, policy-based monitoring, logging, and blocking of connection and query activity executed on specific MySQL servers. Designed to meet the Oracle audit specification, MySQL Enterprise Audit provides an out of box, easy to use auditing and compliance solution for applications that are governed by both internal and external regulatory guidelines.

安装后,审计插件使 MySQL 服务器能够生成包含服务器活动审计记录的日志文件。日志内容包括客户端何时连接和断开连接,以及他们在连接时执行的操作,例如访问哪些数据库和表。您可以添加每个查询的时间和大小统计信息,以检测异常值。When installed, the audit plugin enables MySQL Server to produce a log file containing an audit record of server activity. The log contents include when clients connect and disconnect, and what actions they perform while connected, such as which databases and tables they access. You can add statistics for the time and size of each query to detect outliers.

默认情况下,MySQL 企业审计使用 mysql 系统数据库中的表来持久存储过滤器和用户账户数据。要使用其他数据库,请在服务器启动时设置 audit_log_database 系统变量。By default, MySQL Enterprise Audit uses tables in the mysql system database for persistent storage of filter and user account data. To use a different database, set the audit_log_database system variable at server startup.

在安装审计插件后(参见 第 8.4.5.2 节,“安装或卸载 MySQL 企业审计”),它会写入审计日志文件。默认情况下,该文件在服务器数据目录中命名为 audit.log。要更改文件名称,请在服务器启动时设置 audit_log_file 系统变量。After you install the audit plugin (see Section 8.4.5.2, “Installing or Uninstalling MySQL Enterprise Audit”), it writes an audit log file. By default, the file is named audit.log in the server data directory. To change the name of the file, set the audit_log_file system variable at server startup.

默认情况下,审计日志文件内容以新式 XML 格式编写,不进行压缩或加密。要选择文件格式,请在服务器启动时设置 audit_log_format 系统变量。有关文件格式和内容的详细信息,请参见 第 8.4.5.4 节,“审计日志文件格式”。By default, audit log file contents are written in new-style XML format, without compression or encryption. To select the file format, set the audit_log_format system variable at server startup. For details on file format and contents, see Section 8.4.5.4, “Audit Log File Formats”.

有关如何控制日志记录的详细信息,包括审核日志文件命名和格式选择,请参见第 8.4.5.5 节,“配置审核日志特性”。要执行审核事件的过滤,请参见第 8.4.5.7 节,“审核日志过滤”。有关用于配置审核日志插件的参数说明,请参见审核日志选项和变量。For more information about controlling how logging occurs, including audit log file naming and format selection, see Section 8.4.5.5, “Configuring Audit Logging Characteristics”. To perform filtering of audited events, see Section 8.4.5.7, “Audit Log Filtering”. For descriptions of the parameters used to configure the audit log plugin, see Audit Log Options and Variables.

如果启用了审计日志插件,性能模式(请参见 第 29 章,MySQL 性能模式)对此有相应的监控工具。要识别相关的监控工具,请使用以下查询:If the audit log plugin is enabled, the Performance Schema (see Chapter 29, MySQL Performance Schema) has instrumentation for it. To identify the relevant instruments, use this query:

SELECT NAME FROM performance_schema.setup_instruments
WHERE NAME LIKE '%/alog/%';