Logs are automatically generated during the running of OceanBase Database. By viewing and analyzing these logs, O&M engineers can understand the startup and operation status of OceanBase Database. This topic describes the basic information about logs, including log module types, log file types, log levels, and log formats.
Log module types
Program logs involve two levels of modules: parent modules and submodules.
OceanBase Database provides the following parent modules: CLIENT, CLOG, COMMON, ELECT, LIB, PROXY, RPC, RS, SERVER, SHARE, SQL, STORAGE, and TLOG. If a parent module contains a submodule, the submodule is expressed in the Parent module.Submodule format. For example, in the expression of SQL.PARSER, SQL indicates the SQL module, and SQL.PARSER indicates the PARSER submodule under the SQL module. SQL.* indicates all submodules under the SQL module.
Log file types
OceanBase Database has three types of log files: observer.log, election.log, and rootservice.log. By default, these log files record logs at or above the INFO level. A WARNING log file with the .wf file name extension is automatically generated for each type of log file: observer.log.wf, election.log.wf, and rootservice.log.wf. These WARNING log files record logs at or above the WARN level.
| Log | Path |
|---|---|
Startup and operation logs: observer.log and observer.log.wf |
$work_dir/log on the OBServer |
Election module logs: election.log and election.log.wf |
$work_dir/log on the OBServer |
Root Service logs: rootservice.log and rootservice.log.wf |
$work_dir/log on the OBServer |
Log levels
OceanBase Database supports seven log levels. The following table describes the log levels in descending order.
| Log level | Description |
|---|---|
| ERROR | Critical errors. Logs at this level record system failure information. The system is unavailable until the errors are handled. |
| WARN | Warnings. The system continues to provide services but may not as expected, or a serious error occurs and requires troubleshooting. |
| INFO | General information. Logs at this level record the current operation status of the system. |
| EDIAG | Error diagnosis information, which usually corresponds to a bug of OceanBase Database. |
| WDIAG | Warning diagnosis information indicating expected errors that OceanBase Database can tolerate. |
| TRACE | Task-level debugging information. |
| DEBUG | Debugging information. Logs at this level record details about the operation status of the system during debugging, including the names, parameters, variables, and return values of the functions that are called. |
Log formats
OceanBase Database adopts the following log formats:
[time] log_level [module_name] (file_name:fine_no) [thread_id][Y_trace_id0-trace_id1] [lt=last_log_print_time] [dc=dropped_log_count] log_data_[time] log_level [module_name] function_name (file_name:fine_no) [thread_id][Y_trace_id0-trace_id1] [lt=last_log_print_time] [``dc=``dropped_log_count] log_data_
Sample logs:
[admin@OceanBase000000000.sqa.ztt /home/admin/oceanbase/log]
$tail -f -n 1 observer.log
[2016-07-17 14:18:04.845802] INFO [RPC.OBMYSQL] obsm_handler.cpp:191 [9543][Y0-0] [lt=47] [dc=0] connection close(easy_connection_str(c)="xx.xx.xx.xx:56854_-1_0x7fb8a9171b68", version=0, sessid=2147562562, tenant_id=1, server_id=1, is_need_clear_sessid_=true, ret=0)
[admin@OceanBase000000000.sqa.ztt /home/admin/oceanbase/log]
$tail -f -n 1 observer.log.wf
[2016-07-17 14:18:28.431351] WARN [SQL.SESSION] set_conn (ob_basic_session_info.cpp:2568) [8541][YB420AF4005E-52A8CF4E] [lt=16] [dc=0] debug for set_conn(conn=0x7fb8a9171b68, lbt()="0x4efe71 0x818afd 0xe9ea5b 0x721fc8 0x13747bc 0x2636db0 0x2637d68 0x5054e9 0x7fb98705aaa1 0x7fb9852cc93d ", magic_num_=324478056, sessid_=2147562617, version_=0)
[admin@OceanBase000000000.sqa.ztt /home/admin/oceanbase/log]
$tail -f -n 1 rootservice.log
[2016-07-17 14:18:53.701463] INFO [RS] ob_server_table_operator.cpp:345 [8564][Y0-0] [lt=11] [dc=0] svr_status(svr_status="active", display_status=1)
[admin@OceanBase000000000.sqa.ztt /home/admin/oceanbase/log]
$tail -f -n 1 rootservice.log.wf
[2016-07-16 02:02:12.847602] WARN [RS] choose_leader (ob_leader_coordinator.cpp:2067) [8570][YB420AF4005E-4626EDFC] [lt=8] [dc=0] choose leader info with not same candidate num(tenant_id=1005, server="192.168.0.1:2882", info={original_leader_count:0, primary_zone_count:0, cur_leader_count:1, candidate_count:1, in_normal_unit_count:1})
The following table describes the parameters in logs.
| Parameter | Description |
|---|---|
| time | The time when the log was generated. |
| log_level | The level of the log. |
| module_name | The module that contains the statement corresponding to the log. |
| function_name | The function that contains the statement corresponding to the log. |
| file_name | The file that contains the statement corresponding to the log. |
| file_no | The row number of the statement corresponding to the log. |
| thread_id | The ID of the thread corresponding to the log. |
| trace_id0-trace_id1 | The trace_id value of the log, which consists of trace_id0 and trace_id1. A trace_id value can be transmitted between OBServers through remote procedure calls (RPCs). Therefore, you can obtain associated logs of OBServers based on trace_id values. |
| last_log_print_time | OBServers support synchronous and asynchronous logs. When synchronous logs are enabled, this parameter indicates the amount of time spent on recording the previous log. When asynchronous logs are enabled, this parameter indicates the amount of time spent on formatting the current log. |
| dropped_log_count | The number of dropped logs. |
| log_data | The detailed log data. |