Pada 15 September 2026, semua lingkungan Cloud Composer 1 dan Cloud Composer 2 versi 2.0.x akan mencapai akhir masa pakainya yang direncanakan, dan Anda tidak akan dapat menggunakannya. Sebaiknya rencanakan migrasi ke Cloud Composer 3.
Halaman ini menjelaskan cara mengaktifkan penyimpanan log tugas Airflow ke bucket
lingkungan untuk lingkungan baru atau yang sudah ada.
Sebagai opsi, Anda dapat mengaktifkan sinkronisasi log tugas ke bucket lingkungan.
Tentang menyimpan log ke bucket lingkungan
Menyimpan log ke bucket lingkungan berfungsi dengan cara berikut:
Nonaktif (default): Log tugas tersedia di Cloud Logging. Anda dapat melihatnya di UI Airflow dan di Cloud Logging. File log tugas tidak disimpan ke bucket lingkungan.
Jika penyimpanan log ke bucket lingkungan dinonaktifkan dan Anda mengaktifkannya, log tugas yang ditampilkan di UI Airflow tidak akan menampilkan entri log yang dihasilkan saat log hanya disimpan ke Cloud Logging. Log ini tidak hilang, tetapi masih tersedia di Cloud Logging.
Diaktifkan: Log tugas disimpan ke Cloud Logging dan ke bucket lingkungan. Anda dapat melihatnya di UI Airflow dan di Cloud Logging. Bucket lingkungan menyimpan file dengan log ini.
Jika penyimpanan log ke bucket lingkungan diaktifkan dan Anda
menonaktifkannya, log yang sudah disimpan ke bucket lingkungan
tidak akan dihapus dan tetap disimpan di bucket.
Sebelum memulai
Mulai dari Cloud Composer versi 2.8.0, semua lingkungan tidak
menyimpan log tugas di bucket lingkungan secara default. Log tugas masih tersedia di Cloud Logging dan UI Airflow.
Saat Anda mengupgrade lingkungan, konfigurasi untuk menyimpan log di
bucket lingkungan tidak akan berubah. Misalnya, jika Anda mengupgrade lingkungan yang menyimpan log ke bucket lingkungan ke versi yang lebih baru, lingkungan akan terus menyimpan log ke bucket lingkungan.
Untuk mengaktifkan atau menonaktifkan opsi ini, Anda dapat menggunakan Google Cloud CLI, Cloud Composer API, atau Terraform. Opsi ini tidak dapat diubah
melalui konsol Google Cloud .
Mengaktifkan atau menonaktifkan penyimpanan log tugas ke bucket lingkungan saat membuat lingkungan
gcloud
Saat Anda membuat lingkungan, argumen berikut menentukan cara log tugas
Airflow harus disimpan:
Argumen --disable-logs-in-cloud-logging-only memungkinkan penyimpanan log tugas Airflow ke bucket lingkungan.
Argumen --enable-logs-in-cloud-logging-only menonaktifkan penyimpanan log tugas
Airflow ke bucket lingkungan. Log hanya disimpan ke
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
Saat Anda membuat lingkungan, kolom storage_mode di blok task_logs_retention_config menentukan cara log tugas Airflow harus disimpan:
CLOUD_LOGGING_AND_CLOUD_STORAGE untuk menyimpan log ke bucket lingkungan dan Cloud Logging.
CLOUD_LOGGING_ONLY untuk menyimpan log hanya di Cloud Logging.
Mengaktifkan atau menonaktifkan penyimpanan log tugas ke bucket lingkungan untuk lingkungan yang ada
gcloud
Saat Anda mengupdate lingkungan, argumen berikut akan mengaktifkan atau menonaktifkan
penyimpanan log tugas Airflow ke bucket lingkungan:
Argumen --disable-logs-in-cloud-logging-only memungkinkan penyimpanan log tugas
Airflow ke bucket lingkungan. Log disimpan ke bucket lingkungan dan ke Cloud Logging.
Argumen --enable-logs-in-cloud-logging-only menonaktifkan penyimpanan log tugas
Airflow ke bucket lingkungan. Log hanya disimpan ke
Cloud Logging.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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,["# 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)"]]