get_task_logs
Retrieve logs for a specific Airflow task instance attempt. Use to inspect output and debug failures by specifying DAG, run, task, and attempt number.
Instructions
Fetch logs for a single task instance attempt.
Args:
dag_id: DAG identifier.
run_id: DAG run identifier.
task_id: Task identifier within the DAG.
try_number: Attempt number (1-indexed). Retried tasks have multiple attempts —
call get_run_status to see the latest try_number per task.
map_index: Mapped task index for dynamic task mapping. Use -1 for a normal task.
tail_lines: Return only the last N lines (default 500). Pass null for the full log —
beware, large tasks can produce many MB of output that will blow up context.
Returns:
TaskLogResult with content (log text), truncated (True if tailing dropped earlier
lines), line_count (lines returned), and try_number (echoed back).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dag_id | Yes | ||
| run_id | Yes | ||
| task_id | Yes | ||
| map_index | No | ||
| tail_lines | No | ||
| try_number | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | ||
| truncated | Yes | ||
| line_count | Yes | ||
| try_number | Yes |