Apache Airflow task logs are stored in a logging backend to ensure you can access them after your Pods terminate. By default, Astro Private Cloud uses Vector to collect task logs and export them to an Elasticsearch instance.
You can configure how Astro Private Cloud collects Deployment task logs and exports them to Elasticsearch. The following are the supported methods for exporting task logs to Elasticsearch:
Exporting task logs using a Vector DaemonSet isn’t supported for Airflow 3.
By default, Astro Private Cloud uses a Vector DaemonSet to aggregate task logs. This is the workflow for the default implementation:
stdout.stdout and writes it to the Deployment’s node.Astronomer recommends using Vector DaemonSet for organizations that:
This approach isn’t suited for organizations that don’t allow logging container to run in privileged mode and run many small tasks using the Kubernetes executor. Because task logs exist only for the lifetime of the Pod, your Pods running small tasks might complete before Vector can collect their task logs.
You can use a logging sidecar container to collect and export logs. In this implementation:
This implementation is recommended for organizations that:
Retrieve your values.yaml file. See Apply a config change.
Add the following entry to your values.yaml file:
If you’re migrating from Fluentd, you must also set the following configuration so that Astro Private Cloud can retain logs:
Push the configuration change. See Apply a config change.
You can customize the default Astronomer Vector logging sidecar to have different transformations and sinks based on your team’s requirements. This is useful if you want to annotate, customize, or filter your logs before sending them to your logging platform.
In the Astro UI, go to your Clusters page and select your cluster.
In the cluster details, click Edit in the Deployment Configuration section and add the following override in the Configuration Override field:
For more information on using the Configuration Override in the UI, see Override base configuration.
Save and apply your changes in the UI.
Pushing this change updates the configuration for the cluster. Individual Deployments will receive the new sidecar logging configuration once they are redeployed.
yaml file to change how and where sidecars forward your logs. The following examples are template configurations for each commonly used external logging service. For the complete default logging sidecar configmap, see the Astronomer GitHub.Run the following command to add the configuration file to your cluster as a Kubernetes secret:
Run the following command to annotate the secret so that it’s automatically applied to all new Deployments:
Run the following command to sync existing Deployments with the new configuration:
Add Airflow task logs from your Astronomer Deployment to an existing Elasticsearch instance on Elastic Cloud to centralize log management and analysis. Centralized log management allows you to quickly identify, troubleshoot, and resolve task failure issues. Although these examples use Elastic Cloud, you can also use AWS Managed OpenSearch Service or any other elastic service (managed or hosted). With an external Elasticsearch instance configured for Astro Private Cloud, you can see the logs in your Elasticsearch instance and browse the logs from the APC UI.
In your browser, go to https://cloud.elastic.co/ and create a new Elastic Cloud deployment. See Create a deployment.
Copy and save your Elastic Cloud deployment credentials when the Save the deployment credentials screen appears.
On the Elastic dashboard, click the Gear icon for your Deployment.
Click Copy endpoint next to Elasticsearch.
(Optional) Test the Elastic Cloud deployment endpoint:
After you’ve created an Elastic deployment and endpoint, you have two options to store your Elastic deployment credentials. You can store the credentials in your Astro Private Cloud Helm values, or for greater security, as a secret in your Astro Private Cloud Kubernetes cluster. For additional information about adding an Astro Private Cloud configuration change, see Apply a config change.
Updating the Elasticsearch host in your data plane values.yaml doesn’t automatically update the cluster configuration database. After you upgrade your data plane Helm release, manually update the Elasticsearch proxy host through the UI:
In the Astro UI, go to Clusters and select your cluster.
Click Edit to unlock Configuration Override.
Add the following to the Configuration Override:
Click Update cluster to apply your changes.
Update each existing Deployment to apply the new Elasticsearch configuration.
For more information, see Override base configuration.
Add the following entry to your values.yaml file:
Add the following entry to your values.yaml file to disable internal logging:
Run the following command to upgrade the Astro Private Cloud release version in the values.yaml file:
Click Menu > Discover. The Create index pattern screen appears.
Enter vector.* if you use Vector sidecar logging. In the Name field, enter @timestamp in the Timestamp field, and then click Create index pattern.
Click Menu > Dashboard to view all of the Airflow task logs for your Deployment on Astronomer.