Em 15 de setembro de 2026, todos os ambientes do Cloud Composer 1 e da versão 2.0.x do Cloud Composer 2 vão atingir o fim da vida útil planejado e não poderão mais ser usados. Recomendamos planejar a migração para o Cloud Composer 3.
Esta página explica como ativar o salvamento de registros de tarefas do Airflow no bucket do ambiente para um ambiente novo ou existente.
Como opção, você pode ativar a sincronização dos registros de tarefas com o bucket do ambiente.
Sobre o salvamento de registros no bucket do ambiente
O salvamento de registros no bucket do ambiente funciona da seguinte maneira:
Desativado (padrão): os registros de tarefas estão disponíveis no Cloud Logging. É possível
visualizá-los na interface do Airflow e no Cloud Logging. Os arquivos de registro de tarefas não são salvos no bucket do ambiente.
Se a gravação de registros no bucket do ambiente foi desativada e você a
ativou, os registros de tarefas exibidos na interface do Airflow não mostram entradas de registro
geradas enquanto os registros eram salvos apenas no Cloud Logging. Esses
registros não são perdidos, eles ainda estão disponíveis no Cloud Logging.
Ativado: os registros de tarefas são salvos no Cloud Logging e no bucket do ambiente. É possível acessá-los na interface do Airflow e no Cloud Logging. O bucket do ambiente armazena arquivos com esses registros.
Se a opção de salvar registros no bucket do ambiente tiver sido ativada e você
desativar, os registros que já foram salvos no bucket do ambiente
não serão excluídos e vão permanecer armazenados no bucket.
Antes de começar
A partir da versão 2.8.0 do Cloud Composer, todos os ambientes não armazenam registros de tarefas no bucket do ambiente por padrão. Os registros de tarefas ainda estão
disponíveis na interface do Cloud Logging e do Airflow.
Quando você faz upgrade do ambiente, a configuração para salvar logs no bucket do ambiente não é alterada. Por exemplo, se você fizer upgrade de um ambiente que salvou registros no bucket do ambiente para uma versão mais recente, o ambiente continuará salvando registros no bucket.
Para ativar ou desativar essa opção, use a Google Cloud CLI, a API Cloud Composer ou o Terraform. Não é possível mudar essa opção
pelo console Google Cloud .
Ativar ou desativar o salvamento de registros de tarefas no bucket do ambiente ao criar um ambiente
gcloud
Ao criar um ambiente, os argumentos a seguir especificam como os registros de tarefas do Airflow precisam ser salvos:
O argumento --disable-logs-in-cloud-logging-only permite salvar registros de tarefas do Airflow no bucket do ambiente.
O argumento --enable-logs-in-cloud-logging-only desativa o salvamento de registros de tarefas do Airflow no bucket do ambiente. Os registros são salvos apenas no
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
Ao criar um ambiente, o campo storage_mode no bloco task_logs_retention_config especifica como os registros de tarefas do Airflow precisam ser salvos:
CLOUD_LOGGING_AND_CLOUD_STORAGE para salvar registros no bucket do ambiente e no Cloud Logging.
CLOUD_LOGGING_ONLY para salvar registros apenas no Cloud Logging.
Ativa ou desativa o salvamento de registros de tarefas no bucket do ambiente
gcloud
Ao atualizar um ambiente, os seguintes argumentos ativam ou desativam
a gravação de registros de tarefas do Airflow no bucket do ambiente:
O argumento --disable-logs-in-cloud-logging-only permite salvar registros de tarefas do Airflow no bucket do ambiente. Os registros são salvos no bucket do ambiente e no Cloud Logging.
O argumento --enable-logs-in-cloud-logging-only desativa o salvamento de registros de tarefas do Airflow no bucket do ambiente. Os registros são salvos apenas no
Cloud Logging.
Para salvar os registros do Airflow no bucket do ambiente:
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-26 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,["# Enable saving logs to the environment's bucket\n\n\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---------------------------------------------\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\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-------------------------------------------------------------------------------------------\n\n### gcloud\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\n### API\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\n### Terraform\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------------------------------------------------------------------------------------------\n\n### gcloud\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\n### API\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\n### Terraform\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\n- [View logs](/composer/docs/composer-2/view-logs)\n- [Monitor environments](/composer/docs/composer-2/monitor-environments)"]]