1.查询指定时间段的日志
mysql> SELECT time,instance,left(message,150) FROM cluster_log WHERE message LIKE ‘%ddl%job%ID.80%’ AND type=‘tidb’ AND time > DATE_SUB(NOW(), INTERVAL 30 SECOND) AND time < now();
ERROR 1105 (HY000): denied to scan logs, please specified the start time, such as time > '2020-01-01 00:00:00'
2.如果换成时间串是 OK 的:
mysql> SELECT time,instance,left(message,150) FROM cluster_log WHERE message LIKE ‘%ddl%job%ID.80%’ AND type=‘tidb’ AND time > ‘2024-05-20 10:52:14’ AND time < ‘2024-05-20 10:52:44’;
±------------------------±---------------±-------------------------------------------------------------------------------------------------------------------------------------------------------+
| time | instance | left(message,150) |
±------------------------±---------------±-------------------------------------------------------------------------------------------------------------------------------------------------------+
| 2024/05/20 10:52:15.989 | 127.0.0.1:4000 | [conn.go:1152] [“command dispatched failed”] [conn=4276449321164997027] [connInfo="id:4276449321164997027, addr:127.0.0.1:49908 status:11, collation:u |
±------------------------±---------------±-------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.04 sec)
所以不支持直接使用时间函数?