이 페이지에서는 새 환경 또는 기존 환경에 대한 환경 버킷에 Airflow 태스크 로그를 저장하도록 사용 설정하는 방법을 설명합니다.
옵션으로 환경 버킷에 태스크 로그 동기화를 사용 설정할 수 있습니다.
환경 버킷에 로그 저장 정보
환경 버킷에 로그를 저장하는 방법은 다음과 같습니다.
사용 중지됨 (기본값): Cloud Logging에서 태스크 로그를 사용할 수 있습니다. Airflow UI 및 Cloud Logging에서 확인할 수 있습니다. 태스크 로그 파일이 환경 버킷에 저장되지 않습니다.
환경 버킷에 로그를 저장하는 기능이 사용 중지되어 있었는데 사용 설정한 경우 Airflow UI에 표시된 태스크 로그에는 로그가 Cloud Logging에만 저장된 상태에서 생성된 로그 항목이 표시되지 않습니다. 이러한 로그는 손실되지 않고 계속 Cloud Logging에서 사용할 수 있습니다.
사용 설정됨: 태스크 로그가 Cloud Logging 및 환경의 버킷 모두에 저장됩니다. Airflow UI 및 Cloud Logging에서 볼 수 있습니다. 환경 버킷에는 이러한 로그가 포함된 파일이 저장됩니다.
환경 버킷에 로그를 저장하는 기능을 사용 설정한 후 사용 중지해도 환경 버킷에 이미 저장된 로그는 삭제되지 않고 버킷에 계속 저장됩니다.
시작하기 전에
Cloud Composer 버전 2.8.0부터는 모든 환경에서 기본적으로 환경 버킷에 태스크 로그가 저장되지 않습니다. 태스크 로그는 Cloud Logging 및 Airflow UI에서 계속 사용할 수 있습니다.
환경을 업그레이드해도 환경 버킷에 로그를 저장하기 위한 구성은 변경되지 않습니다. 예를 들어 환경 버킷에 로그를 저장한 환경을 이후 버전으로 업그레이드하면 환경은 계속해서 로그를 환경 버킷에 저장합니다.
이 옵션을 사용 설정하거나 중지하려면 Google Cloud CLI, Cloud Composer API, Terraform을 사용하면 됩니다. Google Cloud 콘솔을 통해 이 옵션을 변경할 수 없습니다.
환경을 만들 때 환경 버킷에 태스크 로그 저장 사용 설정 또는 사용 중지
gcloud
환경을 만들 때 다음 인수는 Airflow 태스크 로그가 저장되는 방법을 지정합니다.
--disable-logs-in-cloud-logging-only 인수는 환경 버킷에 Airflow 태스크 로그 저장을 사용 설정합니다.
--enable-logs-in-cloud-logging-only 인수는 환경 버킷에 Airflow 태스크 로그 저장을 사용 중지합니다. 로그는 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
환경을 만들 때 task_logs_retention_config 블록의 storage_mode 필드는 Airflow 태스크 로그가 저장되는 방법을 지정합니다.
환경의 버킷 및 Cloud Logging에 로그를 저장하기 위한 CLOUD_LOGGING_AND_CLOUD_STORAGE입니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 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)"]]