El 15 de septiembre del 2026, todos los entornos de Cloud Composer 1 y Cloud Composer 2 versión 2.0.x alcanzarán el final de su ciclo de vida previsto y no podrás usarlos. Te recomendamos que planifiques la migración a Cloud Composer 3.
En esta página se explica cómo habilitar el guardado de los registros de tareas de Airflow en el bucket del entorno en un entorno nuevo o en uno ya creado.
Si quiere, puede habilitar la sincronización de los registros de tareas con el
contenedor del entorno.
Acerca de cómo guardar registros en el segmento del entorno
Los registros se guardan en el segmento del entorno de la siguiente manera:
Inhabilitado (valor predeterminado): los registros de tareas están disponibles en Cloud Logging. Puedes verlos en la interfaz de usuario de Airflow y en Cloud Logging. Los archivos de registro de tareas no se guardan en el segmento del entorno.
Si se había inhabilitado el guardado de registros en el segmento del entorno y lo habilitas, los registros de tareas que se muestran en la interfaz de usuario de Airflow no mostrarán las entradas de registro que se generaron mientras los registros se guardaban solo en Cloud Logging. Estos registros no se pierden, sino que siguen estando disponibles en Cloud Logging.
Habilitado: los registros de tareas se guardan tanto en Cloud Logging como en el segmento del entorno. Puedes verlos en la interfaz de usuario de Airflow y en Cloud Logging. El segmento del entorno almacena archivos con estos registros.
Si se había habilitado el guardado de registros en el segmento del entorno y lo inhabilita, los registros que ya se habían guardado en el segmento del entorno no se eliminarán y permanecerán almacenados en el segmento.
Antes de empezar
A partir de la versión 2.8.0 de Cloud Composer, todos los entornos dejan de almacenar los registros de tareas en el bucket del entorno de forma predeterminada. Los registros de tareas siguen estando disponibles en Cloud Logging y en la interfaz de usuario de Airflow.
Cuando actualizas tu entorno, la configuración para guardar los registros en el
contenedor del entorno no cambia. Por ejemplo, si actualizas un entorno que guardaba registros en su segmento a una versión posterior, el entorno seguirá guardando registros en su segmento.
Para habilitar o inhabilitar esta opción, puedes usar la CLI de Google Cloud, la API Cloud Composer o Terraform. No se puede cambiar esta opción
a través de la consola Google Cloud .
Habilitar o inhabilitar el guardado de los registros de tareas en el bucket del entorno al crear un entorno
gcloud
Cuando creas un entorno, los siguientes argumentos especifican cómo se deben guardar los registros de tareas de Airflow:
El argumento --disable-logs-in-cloud-logging-only permite guardar los registros de tareas de Airflow en el segmento del entorno.
El argumento --enable-logs-in-cloud-logging-only inhabilita el guardado de los registros de tareas de Airflow en el segmento del entorno. Los registros solo se guardan en Cloud Logging.
// POST https://composer.googleapis.com/v1/{parent=projects/*/locations/*}/environments{"name":"projects/example-project/locations/us-central1/environments/example-environment","config":{"dataRetentionConfig":{"taskLogsRetentionConfig":{"storageMode":"CLOUD_LOGGING_AND_CLOUD_STORAGE"}}}}
Terraform
Cuando creas un entorno, el campo storage_mode del bloque
task_logs_retention_config especifica cómo se deben guardar los registros de tareas de Airflow:
CLOUD_LOGGING_AND_CLOUD_STORAGE para guardar los registros en el segmento del entorno y en Cloud Logging.
CLOUD_LOGGING_ONLY para guardar los registros solo en Cloud Logging.
Habilitar o inhabilitar el guardado de los registros de tareas en el bucket del entorno en un entorno ya creado
gcloud
Cuando actualizas un entorno, los siguientes argumentos habilitan o inhabilitan el guardado de los registros de tareas de Airflow en el bucket del entorno:
El argumento --disable-logs-in-cloud-logging-only permite guardar los registros de tareas de Airflow en el segmento del entorno. Los registros se guardan en el segmento del entorno y en Cloud Logging.
El argumento --enable-logs-in-cloud-logging-only inhabilita el guardado de los registros de tareas de Airflow en el segmento del entorno. Los registros solo se guardan en Cloud Logging.
Para guardar los registros de Airflow en el segmento del entorno, sigue estos pasos:
[[["Es fácil de entender","easyToUnderstand","thumb-up"],["Me ofreció una solución al problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Es difícil de entender","hardToUnderstand","thumb-down"],["La información o el código de muestra no son correctos","incorrectInformationOrSampleCode","thumb-down"],["Me faltan las muestras o la información que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-29 (UTC)."],[[["\u003cp\u003eThis page provides instructions on how to enable or disable saving Airflow task logs to an environment's bucket within Cloud Composer 2.\u003c/p\u003e\n"],["\u003cp\u003eStarting from Cloud Composer version 2.8.0, task logs are stored in Cloud Logging by default, but you can choose to save them in both Cloud Logging and the environment's bucket.\u003c/p\u003e\n"],["\u003cp\u003eEnabling or disabling this feature can be done using Google Cloud CLI, Cloud Composer API, or Terraform, however it cannot be done through the Google Cloud console.\u003c/p\u003e\n"],["\u003cp\u003eWhen enabling this feature, previously logged data will still remain in Cloud Logging, and if you disable it later, logs already saved to the environment's bucket are not automatically deleted.\u003c/p\u003e\n"],["\u003cp\u003eThe configurations for saving logs remain unchanged during environment upgrades, so if an environment was set to save to the environment's bucket, it will continue doing so after the upgrade.\u003c/p\u003e\n"]]],[],null,["\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\n[Cloud Composer 3](/composer/docs/composer-3/enable-saving-logs-to-environment-bucket \"View this page for Cloud Composer 3\") \\| **Cloud Composer 2** \\| Cloud Composer 1\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThis page explains how to enable saving Airflow task logs to the environment's\nbucket for a new or existing environment.\n\nAs an option, you can enable the synchronization of task logs to the\nenvironment's bucket.\n\nAbout saving logs to the environment's bucket\n\nSaving logs to the environment's bucket works in the following way:\n\n- **Disabled (default)**: Task logs are available in Cloud Logging. You\n can view them in Airflow UI and in Cloud Logging. Task log files\n aren't saved to the environment's bucket.\n\n If saving logs to the environment's bucket was disabled and you\n enable it, task logs displayed in Airflow UI **don't show log entries**\n that were generated while logs were saved only to Cloud Logging. These\n logs aren't lost, they are still available in Cloud Logging.\n- **Enabled**: Task logs are saved both to Cloud Logging and to\n the environment's bucket. You can view them in Airflow UI and in\n Cloud Logging. Environment's bucket stores files with these logs.\n\n If saving logs to the environment's bucket was enabled and you\n disable it, the logs that were already saved to the environment's bucket\n aren't deleted and remain stored in the bucket.\n\nBefore you begin\n\n- Starting from Cloud Composer version 2.8.0, all environments don't\n store task logs in the environment's bucket by default. Task logs are still\n available in Cloud Logging and Airflow UI.\n\n- When you upgrade your environment, the configuration for saving logs in the\n environment's bucket is not changed. For example, if you upgrade an\n environment that saved logs to the environment's bucket to a later version,\n the environment keeps saving logs to the environment's bucket.\n\n- To enable or disable this option, you can use Google Cloud CLI,\n Cloud Composer API, or Terraform. It is not possible to change this option\n through Google Cloud console.\n\nEnable or disable saving task logs to the environment's bucket when creating an environment \n\ngcloud\n\nWhen you create an environment, the following arguments specify how Airflow\ntask logs must be saved:\n\n- `--disable-logs-in-cloud-logging-only` argument enables saving Airflow task logs to the environment's bucket.\n- `--enable-logs-in-cloud-logging-only` argument disables saving Airflow task logs to the environment's bucket. Logs are saved only to Cloud Logging.\n\n gcloud composer environments create \u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e \\\n --location \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --disable-logs-in-cloud-logging-only\n\nReplace the following:\n\n- `ENVIRONMENT_NAME`: the name of your environment.\n- `LOCATION`: the region where the environment is located.\n\nExample: \n\n gcloud composer environments create example-environment \\\n --location us-central1 \\\n --disable-logs-in-cloud-logging-only\n\nAPI\n\nWhen you create an environment, in the [Environment](/composer/docs/reference/rest/v1/projects.locations.environments#Environment)\n\\\u003e [EnvironmentConfig](/composer/docs/reference/rest/v1/projects.locations.environments#EnvironmentConfig) \\\u003e\n[DataRetentionConfig](/composer/docs/reference/rest/v1/projects.locations.environments#dataretentionconfig) \\\u003e\n[TaskLogsRetentionConfig](/composer/docs/reference/rest/v1/projects.locations.environments#tasklogsretentionconfig) resource,\nspecify how Airflow task logs must be saved:\n\n- `CLOUD_LOGGING_AND_CLOUD_STORAGE` to save logs to the environment's bucket and Cloud Logging.\n- `CLOUD_LOGGING_ONLY` to save logs only in Cloud Logging.\n\n {\n \"name\": \"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e/environments/\u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e\",\n \"config\": {\n \"dataRetentionConfig\": {\n \"taskLogsRetentionConfig\": {\n \"storageMode\": \"CLOUD_LOGGING_AND_CLOUD_STORAGE\"\n }\n }\n }\n }\n\nReplace the following:\n\n- `ENVIRONMENT_NAME`: the name of your environment.\n- `LOCATION`: the region where the environment is located.\n- `PROJECT_ID`: the [Project ID](/resource-manager/docs/creating-managing-projects).\n\nExample: \n\n // POST https://composer.googleapis.com/v1/{parent=projects/*/locations/*}/environments\n\n {\n \"name\": \"projects/example-project/locations/us-central1/environments/example-environment\",\n \"config\": {\n \"dataRetentionConfig\": {\n \"taskLogsRetentionConfig\": {\n \"storageMode\": \"CLOUD_LOGGING_AND_CLOUD_STORAGE\"\n }\n }\n }\n }\n\nTerraform\n\nWhen you create an environment, the `storage_mode` field in the\n`task_logs_retention_config` block specifies how Airflow task logs must be\nsaved:\n\n- `CLOUD_LOGGING_AND_CLOUD_STORAGE` to save logs to the environment's bucket and Cloud Logging.\n- `CLOUD_LOGGING_ONLY` to save logs only in Cloud Logging.\n\n resource \"google_composer_environment\" \"example\" {\n provider = google-beta\n name = \"\u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e\"\n region = \"\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e\"\n\n config {\n\n data_retention_config {\n\n task_logs_retention_config {\n\n storage_mode = \"CLOUD_LOGGING_AND_CLOUD_STORAGE\"\n\n }\n }\n }\n\nReplace the following:\n\n- `ENVIRONMENT_NAME`: the name of your environment.\n- `LOCATION`: the region where the environment is located.\n\nExample: \n\n resource \"google_composer_environment\" \"example\" {\n provider = google-beta\n name = \"example-environment\"\n region = \"us-central1\"\n\n config {\n\n data_retention_config {\n\n task_logs_retention_config {\n\n storage_mode = \"CLOUD_LOGGING_AND_CLOUD_STORAGE\"\n\n }\n }\n }\n }\n\nEnable or disable saving task logs to the environment's bucket for an existing environment \n\ngcloud\n\nWhen you update an environment, the following arguments enable or disable\nsaving Airflow task logs to the environment's bucket:\n\n- `--disable-logs-in-cloud-logging-only` argument enables saving Airflow task logs to the environment's bucket. Logs are saved to the environment's bucket and to Cloud Logging.\n- `--enable-logs-in-cloud-logging-only` argument disables saving Airflow task logs to the environment's bucket. Logs are saved only to Cloud Logging.\n\nTo save Airflow logs in the environment's bucket: \n\n gcloud composer environments update \u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e \\\n --location \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --disable-logs-in-cloud-logging-only\n\nReplace the following:\n\n- `ENVIRONMENT_NAME`: the name of your environment.\n- `LOCATION`: the region where the environment is located.\n\nExample: \n\n gcloud composer environments update example-environment \\\n --location us-central1 \\\n --disable-logs-in-cloud-logging-only\n\nAPI\n\n1. Construct an [`environments.patch`](/composer/docs/reference/rest/v1/projects.locations.environments/patch) API request.\n\n2. In this request:\n\n 1. In the `updateMask` parameter, specify the\n `config.dataRetentionConfig.taskLogsRetentionConfig.storageMode`\n mask.\n\n 2. In the request body, specify how Airflow task logs must be\n saved:\n\n - `CLOUD_LOGGING_AND_CLOUD_STORAGE` to save logs to the environment's bucket and Cloud Logging.\n - `CLOUD_LOGGING_ONLY` to save logs only in Cloud Logging.\n\n {\n \"config\": {\n \"dataRetentionConfig\": {\n \"taskLogsRetentionConfig\": {\n \"storageMode\": \"CLOUD_LOGGING_AND_CLOUD_STORAGE\"\n }\n }\n }\n }\n\nExample: \n\n // PATCH https://composer.googleapis.com/v1/projects/example-project/\n // locations/us-central1/environments/example-environment?updateMask=\n // config.dataRetentionConfig.taskLogsRetentionConfig.storageMode\n\n {\n \"config\": {\n \"dataRetentionConfig\": {\n \"taskLogsRetentionConfig\": {\n \"storageMode\": \"CLOUD_LOGGING_AND_CLOUD_STORAGE\"\n }\n }\n }\n }\n\nTerraform\n\nIn the `task_logs_retention_config` block, in the `storage_mode` field specify how Airflow task logs must be saved:\n\n- `CLOUD_LOGGING_AND_CLOUD_STORAGE` to save logs to the environment's bucket and Cloud Logging.\n- `CLOUD_LOGGING_ONLY` to save logs only in Cloud Logging.\n\n resource \"google_composer_environment\" \"example\" {\n provider = google-beta\n name = \"\u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e\"\n region = \"\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e\"\n\n config {\n\n data_retention_config {\n\n task_logs_retention_config {\n\n storage_mode = \"CLOUD_LOGGING_AND_CLOUD_STORAGE\"\n\n }\n }\n }\n\nReplace the following:\n\n- `ENVIRONMENT_NAME`: the name of your environment.\n- `LOCATION`: the region where the environment is located.\n\nExample: \n\n resource \"google_composer_environment\" \"example\" {\n provider = google-beta\n name = \"example-environment\"\n region = \"us-central1\"\n\n config {\n\n data_retention_config {\n\n task_logs_retention_config {\n\n storage_mode = \"CLOUD_LOGGING_AND_CLOUD_STORAGE\"\n\n }\n }\n }\n }\n\nWhat's next\n\n- [View logs](/composer/docs/composer-2/view-logs)\n- [Monitor environments](/composer/docs/composer-2/monitor-environments)"]]