MySqld输出格式

时间:2018-09-08 21:16:39

标签: mysql

我试图了解MySql守护程序在运行时发出到控制台的输出格式。 我一直在寻找有关Daemon写入控制台以解析它并确定其当前状态的格式的文档,但是如果发现与此有关。

示例:

2018-09-08T19:58:11.765549Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.

输出的某些部分在自我解释。格式如下: [DATE]空格[?]空格[LogLevel]空格[?]空格[服务器]空格[消息]

有人可以链接此格式的文档或解释缺少的部分吗?另一个问题是,该消息是否可以包含换行符,并且日志行区域性开始时的日期取决于还是始终YYYY-MM-ddThh:mm:ss:fffZ? (对于解析很重要)。

谢谢。

1 个答案:

答案 0 :(得分:0)

好吧,看到这个问题后,我打开了mysql的文档以使用以下内容查找相关详细信息:

man mysql

尽管我没有得到确切的答案,但是这已经足够接近了。在 MYSQL日志记录下,该文档说明存储为日志的参数。

这里直接来自文档:

   Logging occurs at the “information” level. This corresponds to the
   LOG_INFO priority for syslog on Unix/Linux syslog capability and to
   EVENTLOG_INFORMATION_TYPE for the Windows Event Log. Consult your
   system documentation for configuration of your logging capability.

   Message size is limited to 1024 bytes.

   Messages consist of the identifier MysqlClient followed by these
   values:

   ·   SYSTEM_USER

       The system user name (login name) or -- if the user is unknown.

   ·   MYSQL_USER

       The MySQL user name (specified with the --user option) or -- if the
       user is unknown.

   ·   CONNECTION_ID:

       The client connection identifier. This is the same as the
       CONNECTION_ID() function value within the session.

   ·   DB_SERVER

       The server host or -- if the host is unknown.

   ·   DB

       The default database or -- if no database has been selected.

   ·   QUERY

       The text of the logged statement.

这里是日志示例(需要注意的是,每个日志条目占用1行,与控制台上的输出非常相似)。结构似乎也很相似:

   Here is a sample of output generated on Linux by using --syslog. This
   output is formatted for readability; each logged message actually takes
   a single line.

       Mar  7 12:39:25 myhost MysqlClient[20824]:
         SYSTEM_USER:'oscar', MYSQL_USER:'my_oscar', CONNECTION_ID:23,
         DB_SERVER:'127.0.0.1', DB:'--', QUERY:'USE test;'
       Mar  7 12:39:28 myhost MysqlClient[20824]:
         SYSTEM_USER:'oscar', MYSQL_USER:'my_oscar', CONNECTION_ID:23,
         DB_SERVER:'127.0.0.1', DB:'test', QUERY:'SHOW TABLES;'