get_task_logs
Retrieve execution logs for specific Airflow tasks to debug failures, view output, and analyze performance during workflow runs.
Instructions
Get logs for a specific task instance execution.
Use this tool when the user asks about:
"Show me the logs for task X" or "Get logs for task Y"
"What did task Z output?" or "Show me task execution logs"
"Why did task A fail?" (to see error messages in logs)
"What happened during task B execution?"
"Show me the stdout/stderr for task C"
"Debug task D" or "Troubleshoot task E"
Returns the actual log output from the task execution, which includes:
Task execution output (stdout/stderr)
Error messages and stack traces (if task failed)
Timing information
Any logged messages from the task code
This is essential for debugging failed tasks or understanding what happened during task execution.
Args: dag_id: The ID of the DAG (e.g., "example_dag") dag_run_id: The ID of the DAG run (e.g., "manual__2024-01-01T00:00:00+00:00") task_id: The ID of the task within the DAG (e.g., "extract_data") try_number: The task try/attempt number, 1-indexed (default: 1). Use higher numbers to get logs from retry attempts. map_index: For mapped tasks, which map index to get logs for. Use -1 for non-mapped tasks (default: -1).
Returns: JSON with the task logs content
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dag_id | Yes | ||
| dag_run_id | Yes | ||
| task_id | Yes | ||
| try_number | No | ||
| map_index | No |