Skip to content
Frédéric Descamps edited this page Feb 11, 2021 · 5 revisions

logs

NAME
      logs - MySQL Logs Utility.

DESCRIPTION
      A collection of tools to manage and get information related to the logs
      of MySQL Database Server

Methods:

getErrorLogConfig

getErrorLogConfig([session])

Prints the values of the configuration variables related to the Error Log

 JS  logs.getErrorLogConfig()
MySQL Error Log Settings:
-------------------------
log_error                  : /home/fred/sandboxes/group_sp_msb_8_0_23/node1/data/msandbox.err                                                        
log_error_services         : log_filter_internal; log_sink_internal                                                                                  
log_error_suppression_list :                                                                                                                         
log_error_verbosity        : 2   

setErrorLogVersbosity

Set the values of Error Log Verbosity.

setErrorLogVersbosity([value][, persist][, session])
  • value: Integer. The optional value of the verbosity (1=ERROR, 2=ERROR, WARNING, 3=ERROR, WARNING, INFORMATION). The default is to set it to 3.
  • persist: Bool. Persist the change. Default: false.
  • session: Object. The optional session object used to query the database. If omitted the MySQL Shell's current session will be used.
 JS  logs.setErrorLogVersbosity()
Error Log Verbosity is now set to 3

showErrorLog

Display the Errog Log lines.

showErrorLog([limit][, type][, subsystem][, format][, session])
  • limit: Integer. The amount of lines to display. 0 means no limit. Default: 10.
  • type: String. The type of error entries. Valid values are 'all', 'system', 'error', 'warning' and 'note'. Default is 'all'.
  • subsystem: String. Filter the entries to only get this specific subsystem. Default is 'all'.
  • format: String. One of table, tabbed, vertical, json, ndjson, json/raw, json/array, json/pretty or flat. Flat is like an error log with colors. Default is table.
  • session: Object. The optional session object used to query the database. If omitted the MySQL Shell's current session will be used.
 JS  logs.showErrorLog(3,'all','all','vertical')
*************************** 1. row ***************************
    LOGGED: 2021-02-03 16:56:31.184002
 THREAD_ID: 0
      PRIO: System
ERROR_CODE: MY-013602
 SUBSYSTEM: Server
      DATA: Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
*************************** 2. row ***************************
    LOGGED: 2021-02-03 16:56:31.363887
 THREAD_ID: 0
      PRIO: Warning
ERROR_CODE: MY-013368
 SUBSYSTEM: Server
      DATA: At least one partial revoke exists on a database. Turning ON the system variable '@@partial_revokes'.
*************************** 3. row ***************************
    LOGGED: 2021-02-03 16:56:31.434949
 THREAD_ID: 0
      PRIO: System
ERROR_CODE: MY-010931
 SUBSYSTEM: Server
      DATA: /usr/sbin/mysqld: ready for connections. Version: '8.0.23'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server - GPL

Try the 'flat' format ;-)

tailErrorLog

Tail the Errog Log lines.

logs.tailErrorLog([limit][, type][, subsystem][, refresh][, session])
  • limit: Integer. The amount of lines to display when starting the tail. 0 means no limit. Default: 10.
  • type: String. The type of error entries. Valid values are 'all', 'system', 'error', 'warning' and 'note'. Default is 'all'.
  • subsystem: String. Filter the entries to only get this specific subsystem. Default is 'all'.
  • refresh: Integer. amount of seconds to refresh the tail output. Default is 1.
  • session: Object. The optional session object used to query the database. If omitted the MySQL Shell's current session will be used.

Clone this wiki locally