Display task logs after task completion
Set up log uploading so logs are visible in the Airflow UI after task completion. This requires:- Remote Execution Agent configuration (
values.yaml) - Astro UI Deployment configuration
- Workload identities: write access for the Remote Execution Agent, read access for the Astro API Server
commonEnv block in the following procedures applies environment variables to all Airflow components in the Remote Execution Agent. These variables configure Airflow’s remote logging so that workers and the triggerer upload completed task logs to object storage:
AIRFLOW__LOGGING__REMOTE_LOGGING: Turns on Airflow’s remote log upload.AIRFLOW__LOGGING__REMOTE_LOG_CONN_ID: Names the Airflow connection used to authenticate with object storage.AIRFLOW_CONN_<CONN_ID>: Defines that connection inline, so no separate connection record is required. A URI with no credentials (for example,s3://) causes the underlying cloud SDK to use its default credential chain, which picks up the workload identity attached to the Pod.AIRFLOW__LOGGING__REMOTE_BASE_LOG_FOLDER: Sets the bucket and path prefix that Airflow writes task logs to. Use a Deployment-scoped path so logs from different Deployments don’t collide.AIRFLOW__LOGGING__LOGGING_CONFIG_CLASS: Replaces Airflow’s default logging configuration with the Astronomer Runtime configuration, which installs the task log handler used to write logs to and read logs from object storage.ASTRONOMER_ENVIRONMENT: Set tocloudfor Astro Deployments. Astronomer Runtime reads this value to select Astro-specific logging defaults.
- AWS
- GCP
- Azure
The Astro Orchestration Plane provides secure private connectivity with a pre-configured S3 Gateway Endpoint.
- Configure the following environment variables in the Helm chart’s
values.yaml, and replace the path for theAIRFLOW__LOGGING__REMOTE_BASE_LOG_FOLDERvalue with your information:
values.yaml
-
Run
helm upgradeto apply the change to your Agents. - In the Astro UI, navigate to your Deployment and click the Details tab. Click Edit in the Advanced section to access your logging configurations.
-
Select Bucket Storage in the Task Logs field and fill in the Bucket URL as
s3://<bucket>/<deployment-id>. Or, use the path that you configured forAIRFLOW__LOGGING__REMOTE_BASE_LOG_FOLDERin your Remote Agent’s Helm chart’svalues.yaml. -
In the Workload Identity for Bucket Storage section, select Customer Managed Identity and follow the instructions to set up your Customer Managed Identity so that the identity you create has read access to the specified bucket and path. The Customer Managed Identity must have
s3:GetObjectands3:ListBucketpermissions on the S3 bucket. Additionally, ensure that no ACLs on the bucket restrict those actions.
- If your log bucket is in a different region from your Astro Deployment, you need to define the AWS region in the
AIRFLOW__ASTRONOMER_PROVIDERS_LOGGING__AWS_REGIONenvironment variable for Astronomer-managed components. In the Astro UI, navigate to your Deployment and click the Environment tab. Click Edit Deployment Variables (or + New Environment Variable if you have no variables configured yet), then click Add Variable to add the following environment variables to your Deployment:
AIRFLOW__ASTRONOMER_PROVIDERS_LOGGING__AWS_REGION <The region in which the S3 bucket is configured>
Display task logs during task execution
Once you have post-completion log visibility, you can enable real-time log display. Remote Execution prevents the Airflow API server from reading logs directly from workers until they reach object storage. Use Vector, included in the Remote Execution Agent Helm chart, to upload partial logs while tasks are running.Prerequisites
Before you configure Vector, ensure that your Remote Execution Deployment is already set up to upload task logs to object storage after task completion.Enable Vector sidecar
Use Vector to watch for log file changes and upload updates to object storage during task execution. In your Helmvalues.yaml:
- Set
loggingSidecar.enabledtotrueto inject the Vector container into each worker and triggerer Pod:
values.yaml
- Configure
loggingSidecar.volumeMountsto give Vector read access to the Airflow task log files and a writable location for its on-disk checkpoint state:
values.yaml
task-logs mount is the directory Vector reads from. The vector-data mount stores Vector’s file checkpoints so it can resume uploads after a restart without re-sending lines.
Configure log upload for your cloud provider
TheloggingSidecar.config block is the Vector pipeline definition. Each cloud-specific config uses the same three-stage structure:
sources.airflow_task_logs: Tails the local task log files written by Airflow workers and the triggerer.read_from: beginningensures Vector starts at the top of each file so partial logs aren’t missed.transforms.strip_path_prefix: Removes the local mount path from each event’sfilefield and writes the result tolog_path. This produces an object key that matches the layout Airflow uses when it uploads the complete log after task completion, so the Astro API Server can read both the partial and final logs from the same location.sinks.<cloud>: Uploads the transformed events to object storage.key_prefix(orblob_prefixon Azure) uses thelog_pathfield from the transform to place each log under the right object key.batch.max_bytesandbatch.timeout_secscontrol how often Vector flushes — smaller values stream logs to the UI faster but produce more small objects in storage. See Small file problem.
- AWS S3
- GCP Cloud Storage
- Azure Blob Storage
Configure
loggingSidecar.config:values.yaml
emptyDir volumes that the Vector sidecar and the Airflow worker or triggerer container both mount. task-logs is the directory Airflow writes logs into and Vector reads from. vector-data holds Vector’s checkpoint state. The worker and triggerer mount task-logs at /usr/local/airflow/logs, which is where Airflow writes by default, while the Vector sidecar mounts the same volume at /var/log/airflow/task_logs to match its sources.airflow_task_logs.include glob.
- Configure
workers[*].volumes:
values.yaml
- Configure
workers[*].volumeMounts:
values.yaml
- Configure
triggerer.volumes:
values.yaml
- Configure
triggerer.volumeMounts:
values.yaml
- Set
AIRFLOW__LOGGING__DELETE_LOCAL_LOGSincommonEnvso Airflow removes the local log file after it uploads the complete log to object storage. This keeps the sharedtask-logsvolume from filling up on long-running Pods:
values.yaml
Log upload process
Partial logs are uploaded and displayed as follows:- Airflow worker or triggerer writes local task log files, as set by
AIRFLOW__LOGGING__LOG_FILENAME_TEMPLATE. - Vector watches
/var/log/airflow/task_logs/**/*.logand uploads log changes in chunks while the task runs. - Vector appends a timestamp to the file name before uploading each chunk.
- Airflow scans object storage for log chunks when displaying the UI log view.
- The UI displays all log content to the user.
Version compatibilityUsing Vector to upload logs assumes Airflow’s logging format is compatible. Significant changes to Airflow logging may require reconfiguration.
Caveats
Duplicate log storage
After task completion, Airflow uploads the complete log to object storage and deletes the local copy. This causes duplication:- Partial logs from Vector
- Complete log from Airflow
Small file problem
High-frequency, small log file uploads can create many small objects. This may increase storage costs, load on object storage, or trigger rate limits. Adjust file size and upload frequency in your Vector config to balance performance and cost.- AWS bills object retrieval at a 128KB minimum on certain storage classes (source).
- A large number of small objects means more object requests (PUTs, GETs, LISTs) and more load on metadata/indexing; this can result in rate limits or latency issues.