This topic describes how to retrieve all log entries associated with the given task and created after the specified timestamp.
Ensure that you have the required roles.
To retrieve the application task logs with a specific task
ID and created after a given timestamp use the
app_task_logs
function.
Press CTRL+C to copymysql> SELECT mysql_tasks.app_task_logs('app_user_id', 'task_id', 'newer_than_log_time');
Replace the following:
app_user_id
: the unique ID of the application user who owns the task.task_id
: the unique task ID (UUID
) of the task whose log entries are required.newer_than_log_time
: all the log entries created after the given timestamp are included.
For example:
Press CTRL+C to copymysql> SELECT mysql_tasks.app_task_logs('app_user_01','2299b512-3b90-11f0-a5dc-02001712c792','2025-05-26 10:00:00')\G *************************** 1. row *************************** mysql_tasks.app_task_logs('app_user_01','2299b512-3b90-11f0-a5dc-02001712c792','2025-05-26 10:00:00'): [{"id": "229b9059-3b90-11f0-a5dc-02001712c792", "data": null, "status": "SCHEDULED", "message": "Task created by user.", "task_id": "2299b512-3b90-11f0-a5dc-02001712c792", "log_time": "2025-05-28 06:51:09.043674", "progress": 0}, {"id": "229c6afa-3b90-11f0-a5dc-02001712c792", "data": null, "status": "RUNNING", "message": "Event execution started...", "task_id": "2299b512-3b90-11f0-a5dc-02001712c792", "log_time": "2025-05-28 06:51:09.049183", "progress": 0}, {"id": "229e28f5-3b90-11f0-a5dc-02001712c792", "data": {"connection_id": 6397}, "status": "RUNNING", "message": "Progress monitor started.", "task_id": "2299b512-3b90-11f0-a5dc-02001712c792", "log_time": "2025-05-28 06:51:09.060712", "progress": 0}, {"id": "22b1b908-3b90-11f0-a5dc-02001712c792", "data": null, "status": "COMPLETED", "message": "Execution finished.", "task_id": "2299b512-3b90-11f0-a5dc-02001712c792", "log_time": "2025-05-28 06:51:09.188841", "progress": 100}] 1 row in set (0.2312 sec)
This example lists all the log entries for the task with
task ID
2299b512-3b90-11f0-a5dc-02001712c792
and created after 2025-05-26 10:00:00
.