[[["容易理解","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-09-03 (世界標準時間)。"],[[["\u003cp\u003eData collector resources in Apigee and Apigee hybrid allow for the collection of custom data from API traffic, functioning like a shopping cart for data.\u003c/p\u003e\n"],["\u003cp\u003eThe DataCapture policy specifies the data to be collected, serving as a shopping list, and works in conjunction with the data collector.\u003c/p\u003e\n"],["\u003cp\u003eData collectors can be created through the Apigee UI (both Apigee in Cloud console and Classic Apigee) or via the Apigee API.\u003c/p\u003e\n"],["\u003cp\u003eData collector names must start with \u003ccode\u003edc_\u003c/code\u003e, and creating collectors with names that only differ in case is prohibited due to potential errors.\u003c/p\u003e\n"],["\u003cp\u003eIf a Data collector is used in multiple policies, the last policy to run will overwrite any captured data from earlier executions.\u003c/p\u003e\n"]]],[],null,["# Managing Data Collectors\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\n\n*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*\n\nA\n[data collector](/apigee/docs/reference/apis/apigee/rest#rest-resource:-v1.organizations.datacollectors) resource enables you to collect a wide variety of custom data from API traffic.\nOnce you have created a data collector, you specify the data you want to gather using the\n[DataCapture](/apigee/docs/api-platform/reference/policies/data-capture-policy) policy.\nThe data collector is like a shopping cart, and the DataCapture policy is a shopping list\nfor the data you want to capture.\n| **Note:** If you use a data collector in multiple policies, the captured data will be overwritten by the last policy that executes.\n\nFor a list of the quantities related to API traffic that you can capture\nusing the data collector resource, see\n[Metrics](/apigee/docs/api-platform/analytics/analytics-reference).\n\nCreating a data collector\n-------------------------\n\nYou can create a data collector resource in the Apigee UI or with the Apigee API: \n\n### Apigee in Cloud console\n\nTo create a data collector resource using Apigee in Cloud console:\n\n1. In the Google Cloud console, go to the **Management \\\u003e Data Collectors** page.\n\n [Go to Data Collectors](https://console.cloud.google.com/apigee/datacollectors)\n2. In the **Data Collectors** view, click **Create**.\n3. In the **Add data collector** dialog, enter the following information:\n - **Name** : A name for the data collector. **Note:** The name for a data collector must begin with `dc_`.\n | **Warning:** Do *not* create two data collectors whose names differ only by case, such as `dc_my_data` and `dc_My_Data`, as then exporting data will result in a \"duplicate column names\" error.\n - **Type** : The type of the data to be collected (`Integer`, `String`, and so on).\n - **Description**: An informal description of the data to be collected, possibly including the reason for collecting it. This is for the benefit of other API developers who may be involved in analyzing the data.\n4. Click **Add**.\n\n### Classic Apigee\n\nTo create a data collector resource using the Classic Apigee:\n\n1. Open the [Apigee UI](https://apigee.google.com) in a browser.\n2. Select **Admin \\\u003e Data Collectors** in the navigation pane.\n\n This displays the Data Collectors pane.\n\n The pane shown above is empty because no data collectors have been created yet. At\n this point, you can create a new data collector. Once some data collectors have been\n created, you can click their names in the pane to edit them.\n3. Click **+ CREATE** to display the **Add data collector** dialog.\n\n4. Add the following information in the dialog:\n - **Name** : A name for the data collector. **Note:** The name for a data collector must begin with `dc_`.\n | **Note:** Do *not* create two data collectors whose names differ only by case, such as `dc_my_data` and `dc_My_Data`, as then exporting data will result in a \"duplicate column names\" error.\n - **Type** : The type of the data to be collected (`Integer`, `String`, and so on).\n - **Description**: An informal description of the data to be collected, possibly including the reason for collecting it. This is for the benefit of other API developers who may be involved in analyzing the data.\n5. Click **Add**.\n\nThe new data collector now appears in the Data collector pane.\n\n\nTo edit or delete a data collector, click the three dots at the end\nof its row under **Actions** ,\nand select either **Edit** or **Delete**.\n\n### Apigee API\n\nYou can create a [data collector](/apigee/docs/reference/apis/apigee/rest/v1/organizations.datacollectors) resource using the Apigee API. For example: \n\n```\ncurl -H \"Authorization: Bearer $(gcloud auth print-access-token)\" -X POST -H \"content-type:application/json\" \\\n -d '\n{\n \"name\": \"dc_data_collector\",\n \"description\": \"Collects data for analysis.\",\n \"type\": \"STRING\",\n}' \\\n \"https://apigee.googleapis.com/v1/organizations/ORG/datacollectors\"\n```\n\nwhere \u003cvar translate=\"no\"\u003eORG\u003c/var\u003e is the name of the organization.\nThis creates a resource named `dc_data_collector`, which you can use in\nthe [DataCapture](/apigee/docs/api-platform/reference/policies/data-capture-policy) policy.\n| **Notes:**\n|\n| - The name of the data collector resource must begin with the prefix `dc_`.\n| - If you use a data collector in multiple DataCapture policies, the captured data will be overwritten by the last policy that executes.\n| **Warning:** Do *not* create two data collectors whose names differ only by case, such as `dc_my_data` and `dc_My_Data`, as then exporting data will result in a \"duplicate column names\" error."]]