검색창을 사용하여 이 페이지를 찾은 경우 부제목이 Monitoring인 결과를 선택합니다.
정책 만들기를 클릭합니다.
예약된 쿼리의 행 수 측정항목을 선택합니다. 측정항목 선택 메뉴에서 BigQuery DTS 구성 > Transfer_config > 마지막으로 실행된 작업 행 수를 클릭합니다.
필터 추가에서 필터 추가를 클릭합니다.
필터 메뉴에서 config_id를 선택합니다.
값 메뉴에서 알림을 만들 예약된 쿼리의 config_id를 선택합니다.
필터를 설정하지 않으면 알림에서 예약된 모든 쿼리의 출력을 테스트합니다. 예약된 쿼리의 config_id를 확인하려면 행 수 측정항목 이해하기를 참조하세요.
데이터 변환 설정을 기본값으로 유지하고 다음을 클릭합니다.
조건 유형에 기준점을 선택합니다.
원하는 조건을 선택합니다. 예를 들어 쿼리에서 행이 반환될 때 트리거되도록 하려면 다음 조건을 설정합니다.
알림 트리거에서 모든 시계열 위반을 선택합니다.
기준 위치에서 기준 초과를 선택합니다.
기준 값에 0를 입력합니다.
고급 옵션을 기본값으로 유지하고 다음을 클릭합니다.
선택사항: 알림에 대한 알림을 구성하려면 알림 채널 사용 전환 버튼을 클릭한 다음 알림의 채널과 제목을 설정합니다. 사고 종료에 대한 알림을 설정할 수도 있습니다.
알림을 받지 않으려면 알림 채널 사용 전환 버튼을 선택 해제합니다.
선택사항: 알림 정책이 많은 경우 예약된 쿼리에서 파생되었음을 나타내기 위해 알림 정책에 라벨을 주석으로 추가할 수 있습니다.
(선택사항) 문서 필드에 알림을 해석하는 데 도움이 되는 링크를 추가할 수 있습니다. 예를 들어 유사한 쿼리를 사용하여 로그 탐색기 페이지로 연결되는 링크를 추가하여 알림을 발생시킨 데이터를 탐색할 수 있습니다. 특정 예약된 쿼리의 세부정보 페이지로 연결할 수도 있습니다.
알림 정책 이름 지정에 알림 이름을 입력합니다.
정책 만들기를 클릭합니다.
제한사항
예약된 쿼리의 알림 정책에는 다음과 같은 제한사항이 적용됩니다.
예약된 쿼리 실행 빈도와 수집 지연은 로그 내보내기부터 알림까지의 총 시간에 영향을 미칩니다. 예를 들어 쿼리가 30분마다 실행되고 수집 지연을 위해 15분 지연을 추가하면 위반 로그 항목을 내보낸 후 약 15분 후에 알림이 실행됩니다. 경우에 따라 최대 45분이 걸릴 수 있습니다.
예약된 쿼리와 알림 정책 간의 구성이 연결되거나 동기화되지 않습니다. 한 곳에서 구성을 수정하면 알림 기능을 사용 설정하는 관계가 깨질 수 있습니다.
[[["이해하기 쉬움","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-04(UTC)"],[],[],null,["# Set up alerts with scheduled queries\n====================================\n\nThis document describes how to set up an alert using a BigQuery\nscheduled query. This approach supports custom use cases defined by query logic.\n\nBefore you begin\n----------------\n\nBefore you use Cloud Monitoring, ensure that you have the following:\n\n- A Cloud Billing account.\n- A BigQuery project with billing enabled.\n\nOne way to ensure that you have both is to complete the\n[Quickstart using the Google Cloud console](/bigquery/docs/quickstarts/query-public-dataset-console#before-you-begin).\n\nCreate a SQL query\n------------------\n\nCreate and run a SQL query in BigQuery that generates the\noutput for your alert. The query captures the logic that you want to monitor.\nFor more information, see [Run a query](/bigquery/docs/running-queries).\n\nSet up a scheduled query\n------------------------\n\nYou can schedule queries to run on a recurring basis, from every 15 minutes\nto every several months. You can write any query over your log buckets. For more\ninformation, see [Scheduling queries](/bigquery/docs/scheduling-queries).\n\n### Understand the row count metric\n\nScheduled queries automatically create a metric in Cloud Monitoring. This\nmetric records the number of rows that the SQL query returned during its last\nevaluation. You can create an alert policy that monitors this row count metric\nin Monitoring.\n\nThe following [metric](/monitoring/api/metrics_gcp_a_b#gcp-bigquerydatatransfer)\nis a gauge that contains the most recent row count of a scheduled query:\n\n`bigquerydatatransfer.googleapis.com/transfer_config/last_execution_job_rows`\n\nAll scheduled queries write their row count to this metric, using different labels. You need the `config_id` label when you define an alert policy. To find the `config_id` label, follow these steps:\n\n1. In Google Cloud console, go to the **Scheduled queries** page:\n\n [Go to Scheduled queries](https://console.cloud.google.com/bigquery/scheduled-queries)\n2. Click the scheduled query for which you want to create an alert.\n\n3. Go to the **Details** tab.\n\n4. Check the last string in **Resource name**, as shown in the following\n screenshot:\n\n| **Note:** The last known value for the row count repeats continuously for 5 weeks. If you deactivate a scheduled query or the query fails, the metric remains constant at its last known value for 35 days. After 35 days, the metric disappears.\n\nIf a problem occurs with the scheduled query, an error message appears in the\n**Run history** tab of your scheduled query.\n\n### Monitor scheduled queries\n\nMonitor scheduled queries to ensure successful executions:\n\n- Look for errors in the **Run history** tab of the scheduled query.\n- Check the final status of each scheduled execution that is stored in the `completion_state` field of the [`bigquerydatatransfer.googleapis.com/transfer_config/completed_runs` metric](/monitoring/api/metrics_gcp_a_b#gcp-bigquerydatatransfer).\n- Look for errors in the [BigQuery Data Transfer Service logs](/bigquery/docs/dts-monitor#logs).\n\nCreate an alert policy\n----------------------\n\nUse a [metric-threshold alert](/monitoring/alerts/using-alerting-ui) to detect\nwhen the number of rows returned by the scheduled query differs from a threshold.\n\nTo set up an alert on the number of rows a scheduled query returns, follow these\nsteps:\n\n1. In the Google Cloud console, go to the\n *notifications* **Alerting** page:\n\n [Go to **Alerting**](https://console.cloud.google.com/monitoring/alerting)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Monitoring**.\n2. Click **Create policy**.\n\n3. Select the row count metric for the scheduled query. In the\n **Select a metric** menu, click **BigQuery DTS Config \\\u003e Transfer_config \\\u003e Last executed job row count**.\n\n4. In **Add filters** , click **Add a filter**.\n\n5. In the **Filter** menu, select **config_id**.\n\n6. In the **Value** menu, select the `config_id` of the scheduled query for\n which you want to create an alert:\n\n If you don't set a filter, your alert tests the output of every scheduled\n query. To find the `config_id` of your scheduled query, see\n [Understand the row count metric](#understand_the_row_count_metric).\n7. Keep the default **Transform data** settings and click **Next**.\n\n8. For **Condition types** , select **Threshold**.\n\n9. Select the condition that you want. For example, to trigger when the query\n returns any rows, set the following condition:\n\n 1. For **Alert trigger** , select **Any time series violates**.\n 2. For **Threshold position** , select **Above threshold**.\n 3. In **Threshold value** , enter `0`.\n10. Keep the default **Advanced Options** and click **Next**.\n\n11. Optional: To configure notifications for your alert, click the\n **Use notification channel** toggle, and then set channels and subject line\n for your notifications. You can also set notifications for incident closure.\n\n If you don't want notifications, deselect the **Use notification channel**\n toggle.\n12. Optional: If you have many alert policies, you can [annotate labels](/monitoring/alerts/labels)\n on them to indicate that they are derived from scheduled queries.\n\n13. Optional: In the **Documentation** field, you can add links that help to\n interpret the alert. For example, you can add a link to the **Logs Explorer**\n page with a similar query, so that you can explore the data that raised the\n alert. You can also link to the specific schedule query's details page.\n\n14. In **Name the alert policy**, enter a name for your alert.\n\n15. Click **Create Policy**.\n\nLimitations\n-----------\n\nAlert policies for scheduled queries are subject to the following limitations:\n\n- Scheduled query execution frequency and ingestion delay impact the total time from log emission to alert. For example, if your query runs every 30 minutes and you add a 15-minute lag for ingestion delay, your alert fires approximately 15 minutes after an offending log entry is emitted. In some cases, it might take up to 45 minutes.\n- The configuration between a scheduled query and an alert policy isn't linked or synchronized. Editing the configuration in one place might break the relationship that enables the alert function.\n\nWhat's next\n-----------\n\n- Learn how to create and run [scheduled queries](/bigquery/docs/scheduling-queries)."]]