Error events intended for the error log contain a set of fields, each of which consists of a key/value pair. An event field may be classified as core, optional, or user-defined:用于错误日志的错误事件包含一组字段,每个字段由一个键/值对组成。事件字段可以分为核心字段、可选字段或用户定义字段:
A core field is set up automatically for error events. However, its presence in the event during event processing is not guaranteed because a core field, like any type of field, may be unset by a log filter. 为错误事件自动设置核心字段。然而,在事件处理过程中,它在事件中的存在并不能得到保证,因为与任何类型的字段一样,核心字段可能会被日志筛选器取消设置。If this happens, the field cannot be found by subsequent processing within that filter and by components that execute after the filter (such as log sinks).如果发生这种情况,则该筛选器内的后续处理以及筛选器之后执行的组件(如日志接收器)将无法找到该字段。
An optional field is normally absent but may be present for certain event types. When present, an optional field provides additional event information as appropriate and available.可选字段通常不存在,但对于某些事件类型可能存在。如果存在,可选字段会提供适当且可用的附加事件信息。
A user-defined field is any field with a name that is not already defined as a core or optional field. A user-defined field does not exist until created by a log filter.用户定义字段是指名称尚未定义为核心字段或可选字段的任何字段。用户定义的字段只有由日志筛选器创建后才存在。
As implied by the preceding description, any given field may be absent during event processing, either because it was not present in the first place, or was discarded by a filter. 正如前面的描述所暗示的,任何给定的字段在事件处理过程中都可能不存在,要么是因为它一开始就不存在,或者是被筛选器丢弃了。For log sinks, the effect of field absence is sink specific. For example, a sink might omit the field from the log message, indicate that the field is missing, or substitute a default. When in doubt, test: use a filter that unsets the field, then check what the log sink does with it.对于日志接收器,字段缺失的影响是特定于接收器的。例如,接收器可能会从日志消息中省略该字段,指示该字段丢失,或者替换默认字段。当有疑问时,测试:使用一个取消设置字段的筛选器,然后检查日志接收器对它做了什么。
The following sections describe the core and optional error event fields. For individual log filter components, there may be additional filter-specific considerations for these fields, or filters may add user-defined fields not listed here. For details, see the documentation for specific filters.以下部分介绍了核心和可选错误事件字段。对于单个日志筛选器组件,这些字段可能需要额外的筛选器特定注意事项,或者筛选器可能会添加此处未列出的用户定义字段。有关详细信息,请参阅特定筛选器的文档。
These error event fields are core fields:这些错误事件字段是核心字段:
time
The event timestamp, with microsecond precision.事件时间戳,精度为微秒。
msg
The event message string.事件消息字符串。
prio
The event priority, to indicate a system, error, warning, or note/information event. This field corresponds to severity in 事件优先级,用于指示系统、错误、警告或备注/信息事件。此字段对应于syslog
. The following table shows the possible priority levels.syslog
中的严重性。下表显示了可能的优先级。
Event Type | Numeric Priority |
---|---|
System event | 0 |
1 | |
2 | |
3 |
The prio
value is numeric. Related to it, an error event may also include an optional label
field representing the priority as a string. prio
值是数字。与此相关的是,错误事件还可以包括一个可选的label
字段,该字段将优先级表示为字符串。For example, an event with a 例如,prio
value of 2 may have a label
value of 'Warning'
.prio
值为2的事件的label
值可能为'Warning'
。
Filter components may include or drop error events based on priority, except that system events are mandatory and cannot be dropped.筛选器组件可以根据优先级包括或删除错误事件,但系统事件是强制性的且不能删除。
In general, message priorities are determined as follows:通常,消息优先级的确定如下:
Is the situation or event actionable?情况或事件是否可行?
Yes: Is the situation or event ignorable?是的:这种情况或事件是可以忽略的吗?
Yes: Priority is warning.是:优先级是警告。
No: Priority is error.否:优先级错误。
No: Is the situation or event mandatory?否:这种情况或事件是强制性的吗?
Yes: Priority is system.是的:优先是系统。
No: Priority is note/information.否:优先级为备注/信息。
err_code
The event error code, as a number (for example, 事件错误代码,作为一个数字(例如1022
).1022
)。
err_symbol
The event error symbol, as a string (for example, 事件错误符号,作为字符串(例如'ER_DUP_KEY'
).'ER_DUP_KEY'
)。
SQL_state
The event SQLSTATE value, as a string (for example, 事件SQLSTATE值,作为字符串(例如'23000'
).'23000'
)。
subsystem
The subsystem in which the event occurred. 发生事件的子系统。Possible values are 可能的值有InnoDB
(the InnoDB
storage engine), Repl
(the replication subsystem), Server
(otherwise).InnoDB
(InnoDB
存储引擎)、Repl
(复制子系统)、Server
(其他)。
Optional error event fields fall into the following categories:可选的错误事件字段分为以下几类:
Additional information about the error, such as the error signaled by the operating system or the error lable:有关错误的附加信息,例如操作系统发出的错误信号或错误标签:
OS_errno
The operating system error number.操作系统错误编号。
OS_errmsg
The operating system error message.操作系统错误消息。
label
The label corresponding to the 与prio
value, as a string.prio
值相对应的标签,作为字符串。
Identification of the client for which the event occurred:发生事件的客户端的标识:
user
The client user.客户端用户。
host
The client host.客户端主机。
thread
The ID of the thread within mysqld responsible for producing the error event. mysqld中负责生成错误事件的线程的ID。This ID indicates which part of the server produced the event, and is consistent with general query log and slow query log messages, which include the connection thread ID.此ID指示服务器的哪个部分生成了事件,并且与包括连接线程ID的常规查询日志和慢速查询日志消息一致。
query_id
The query ID.查询ID。
Debugging information:调试信息:
source_file
The source file in which the event occurred, without any leading path.发生事件的源文件,没有任何前导路径。
source_line
The line within the source file at which the event occurred.源文件中发生事件的行。
function
The function in which the event occurred.发生事件的函数。
component
The component or plugin in which the event occurred.发生事件的组件或插件。