get_log
Retrieve task execution logs from Apache Airflow by specifying DAG ID, task ID, run ID, and try number for monitoring and debugging workflows.
Instructions
Get the log from a task instance by DAG ID, task ID, DAG run ID and task try number
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dag_id | Yes | ||
| task_id | Yes | ||
| dag_run_id | Yes | ||
| task_try_number | Yes |
Implementation Reference
- src/airflow/taskinstance.py:117-126 (handler)The handler function implementing the 'get_log' tool logic, which retrieves task instance logs via the Airflow TaskInstanceApi and returns them as text content.async def get_log( dag_id: str, task_id: str, dag_run_id: str, task_try_number: int ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]: response = task_instance_api.get_log( dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id, task_try_number=task_try_number, ) return [types.TextContent(type="text", text=str(response.to_dict()))]
- src/airflow/taskinstance.py:23-27 (registration)The registration entry for the 'get_log' tool within the get_all_functions() list used for tool registration.get_log, "get_log", "Get the log from a task instance by DAG ID, task ID, DAG run ID and task try number", True, ),