Eventarc에서는 필터링할 때 경로 패턴을 적용할 수 있습니다. 경로 패턴 구문을 사용하면 이벤트와 일치하는 표현식을 정의할 수 있습니다. 이렇게 하면 만드는 Eventarc 트리거의 세부사항을 제어하고 특정 이벤트를 캡처하여 조치를 취할 수 있습니다. 예를 들어 특정 파일 변경과 같이 단일 이벤트에 적용되는 트리거를 만들거나 패턴 범위를 확장하고 더 광범위하게 적용되는 트리거를 만들 수 있습니다.
경로 패턴 적용
Eventarc Google Cloud 콘솔 페이지를 사용하거나 gcloud 명령어를 실행하면 트리거를 만들 때 경로 패턴을 적용하여 이벤트를 필터링할 수 있습니다.
예를 들어 리소스 이름 또는 데이터베이스 인스턴스(단일 인스턴스 또는 경로)를 필터링할 때 경로 패턴을 적용할 수 있습니다.
리소스 이름 경로 패턴은 Cloud 감사 로그 이벤트 트리거를 만들 때와 resourceName 값에 지정됩니다. 리소스 이름은 감사 로그를 통해 감사되는 리소스를 나타냅니다.
리소스 이름은 슬래시로 구분된 리소스 자체의 ID와 상위 리소스의 ID로 구성된 식별자를 통해 계층적으로 구성됩니다(예: /projects/project-1/datasets/dataset-id).
Eventarc에서 수행한 필터링은 이러한 식별자 값을 기준으로 패턴을 일치시킵니다. 자세한 내용은 이 문서의 리소스 이름 형식을 참조하세요.
데이터베이스 인스턴스 경로 패턴을 지정하면 Firebase 실시간 데이터베이스 패턴에 대한 트리거를 만들 때, 그리고 instance 또는 ref 값에 적용됩니다. 데이터베이스 인스턴스는 Firebase 실시간 데이터베이스 인스턴스를 나타냅니다. 데이터베이스 인스턴스의 인스턴스 이름 또는 해당 경로나 모든 하위 항목에서 데이터가 생성, 업데이트 또는 삭제될 때 이벤트를 수신할 문서 경로에 경로 패턴을 적용할 수 있습니다.
리소스 ID 경로 패턴 지정은 Cloud IoT 이벤트에 대한 트리거를 만들 때 그리고 registry 및 device 값에 적용됩니다.
경로 패턴을 적용하여 와일드 카드 일치를 통해 레지스트리와 레지스트리의 기기의 변경사항을 필터링할 수 있습니다.
그러나 경로 패턴 일치는 리소스 리전성에 의해 제한됩니다. 예를 들어 Cloud 감사 로그 트리거의 경우 위치 와일드 카드는 Cloud 감사 로그 리전의 트리거나 전역 트리거만 일치합니다.
캡처 그룹
CaptureGroup을 사용하면 표현식의 콘텐츠를 캡처할 수 있습니다. 이렇게 하려면 중괄호로 값을 변수 이름에 할당합니다(예: buckets/{path=**}/files/{filename=file-*.txt}). 단일 세그먼트 와일드 카드는 캡처 그룹의 =*를 생략할 수 있습니다(예: /projects/_/buckets/{bucket}/objects/file.*).
리소스 이름 형식
다음 표에는 일반적으로 사용되는Google Cloud 서비스의 전체 리소스 이름 예시가 나와 있습니다. 전체 목록이 아닙니다. 전체 리소스 이름 형식에 대한 자세한 내용은 API 설계 가이드의 리소스 이름 섹션을 참조하세요.
[[["이해하기 쉬움","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(UTC)"],[[["\u003cp\u003eEventarc allows for the application of path patterns when filtering events, enabling users to create triggers that are granular or broad in scope, according to the specific events or resources they need to monitor.\u003c/p\u003e\n"],["\u003cp\u003ePath patterns can be applied to filter on resource names for Cloud Audit Logs events, database instances for Firebase Realtime Database events, or registry/device values for Cloud IoT events.\u003c/p\u003e\n"],["\u003cp\u003eYou can determine if an event provider supports path patterns by using the \u003ccode\u003egcloud eventarc providers describe\u003c/code\u003e command, which will indicate if \u003ccode\u003epathPatternSupported\u003c/code\u003e is \u003ccode\u003etrue\u003c/code\u003e in the output for a given attribute.\u003c/p\u003e\n"],["\u003cp\u003eThe path pattern syntax supports wildcards (\u003ccode\u003e*\u003c/code\u003e, \u003ccode\u003e**\u003c/code\u003e), capture groups (\u003ccode\u003e{ID}\u003c/code\u003e), and name segments to match parts of resource names or paths, with specific rules and limitations for each.\u003c/p\u003e\n"],["\u003cp\u003eResource names follow a hierarchical format, and pattern matching is constrained by resource regionality, meaning that wildcards will only match within the specific region or global scope of a resource.\u003c/p\u003e\n"]]],[],null,["# Understand path patterns\n\n[Standard](/eventarc/standard/docs/overview)\n|\n| **Preview**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nEventarc supports applying a path pattern when filtering. The path\npattern syntax lets you define an expression that matches events. This lets\nyou control the granularity of the Eventarc trigger you are\ncreating, and to capture and act on certain events. For example, you can create\na trigger that applies to a single event, such as a change to a specific file,\nor you can extend the scope of the pattern and create a trigger that applies\nmore broadly.\n\nApply a path pattern\n--------------------\n\nYou can apply a path pattern to filter events when you create a trigger\nusing the Eventarc Google Cloud console page or by running\na `gcloud` command.\n\nFor example, you can apply a path pattern when filtering on *resource names* or\n*database instances* (a single instance or a path).\n\n- Specifying a **resource name path pattern** applies when creating a trigger\n for **Cloud Audit Logs events** and to `resourceName` values. A resource\n name indicates the resource being audited through an audit log.\n Resource names are organized hierarchically using identifiers made up of the\n ID of the resource itself and the IDs of any parent resources, all separated by\n forward slashes, like this: `/projects/project-1/datasets/dataset-id`.\n The filtering done by Eventarc matches patterns based on the\n values of these identifiers. For more information, in this document, see\n [Resource name format](#resource-name-format).\n\n- Specifying a **database instance path pattern** applies when creating a\n trigger for **Firebase Realtime Database events** and to `instance` or `ref`\n values. A database instance indicates a Firebase Realtime Database\n instance. You can apply a path pattern to the instance name of the database\n instance, or a document path for which you want to receive events when data is\n created, updated, or deleted in that path, or any of its children.\n\n- Specifying a **resource ID path pattern** applies when creating a trigger\n for **Cloud IoT events** and to `registry` and `device` values.\n You can apply a path pattern to filter changes in registries, and devices in a\n registry, with wildcard matching.\n\nFor details, see the instructions to\n[create a trigger for a specific provider, event type, and destination](/eventarc/standard/docs/event-providers-targets#triggers).\n\nIdentify if you can apply a path pattern\n----------------------------------------\n\nTo confirm if you can apply a path pattern to an attribute of an event from a\nprovider, describe the event provider. For example: \n\n```bash\ngcloud eventarc providers describe cloudaudit.googleapis.com --location=us-central1\n```\n\nThe output is similar to the following and a `pathPatternSupported` value of\n`true` indicates that you can apply a path pattern: \n\n```bash\ndisplayName: Cloud Audit Logs\neventTypes:\n- description: An audit log is created that matches the trigger's filter criteria.\n filteringAttributes:\n - attribute: methodName\n description: The identifier of the service's operation.\n required: true\n - attribute: resourceName\n description: The complete path to a resource. Used to filter events for a specific\n resource.\n pathPatternSupported: true\n - attribute: serviceName\n description: The identifier of the Google Cloud service.\n required: true\n - attribute: type\n required: true\n type: google.cloud.audit.log.v1.written\nname: projects/project-name/locations/us-central1/providers/cloudaudit.googleapis.com\n```\n\nOr, for example: \n\n```bash\ngcloud eventarc providers describe firebasedatabase.googleapis.com --location=us-central1\n```\n\nWhere the output is similar to the following: \n\n```bash\ndisplayName: Firebase Realtime Database\neventTypes:\n- description: New data has been created in the database.\n filteringAttributes:\n - attribute: instance\n description: A single database instance.\n pathPatternSupported: true\n required: true\n - attribute: ref\n description: Pattern to match for the database instance.\n pathPatternSupported: true\n required: true\n - attribute: type\n required: true\n type: google.firebase.database.ref.v1.created\n[...]\n```\n\nFor more information, see\n[`gcloud eventarc providers describe`](/sdk/gcloud/reference/eventarc/providers/describe).\n\nPath pattern syntax\n-------------------\n\nThe path pattern syntax is defined as follows:\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n#### Legend:\n\n^**1**^ Only listed ASCII characters are supported. Regular expression matching is not supported. Supported metacharacters:\n\n- `\\w` refers to a word; also represented as `[a-zA-Z0-9_]`\n- `\\t` refers to a tab\n- `\\s` refers to a whitespace character\n\n### Expressions\n\nAn expression can be one of the following segment types and cannot be empty:\n\n- A single segment `Wildcard` defined as `*` matches zero or more characters in the pattern.\n- A `MultiSegmentWildcard` defined as `**` matches zero or more segments in the pattern.\n- A `NameSegment`consists of zero or one `*` and other characters. This combination lets you filter by prefix, suffix, or file extension; for example, `file-*.txt`.\n\nNote that a path can contain many single segment wildcards, but only\none multiple segment wildcard. For example, the following path is invalid:\n`/projects/**/buckets/**`.\n\n### Resource regionality\n\nResource names can contain location identifiers. For example:\n\n`/projects/$PROJECT_ID/`**locations/$REGION**`/triggers/my-trigger`\n\nHowever, path pattern matching is constrained by resource regionality. For\nexample, for Cloud Audit Logs triggers, location wildcards only match\ntriggers from the Cloud Audit Logs region, or global triggers.\n\n### Capture groups\n\nA `CaptureGroup` lets you capture the content of an expression. You do this\nby assigning the value to a variable name in braces; for example,\n`buckets/{path=**}/files/{filename=file-*.txt}`. A single segment wildcard can\nomit `=*` in a capture group; for example,\n`/projects/_/buckets/{bucket}/objects/file.*`\n| **Note:** Capture groups have no semantic meaning; only the syntax is supported.\n\nResource name format\n--------------------\n\nThe following table provides examples of full resource names for commonly used\nGoogle Cloud services. **It is not a complete list.** To learn more about how\nfull resource names are formatted, see the\n[Resource names](/apis/design/resource_names) section of the API design guide.\n\n^1^ For Cloud Firestore, don't specify a leading slash\nwhen creating a trigger\n(see [examples](/eventarc/standard/docs/run/route-trigger-cloud-firestore#create-trigger)).\nFor more information, see\n[Cloud Firestore data model](https://firebase.google.com/docs/firestore/data-model).\n\n^2^ For Cloud Storage, resource names contain an\nunderscore (`_`) rather than a project ID. You *cannot* replace the underscore\nwith a project ID, project name, or project number.\n\n^3^ For Cloud Storage, use the entire object name, including\nforward slashes. These characters are\n[part of the object name](/storage/docs/objects#naming), not path separators.\n\nExamples\n--------\n\nThe following examples demonstrate how you can and can't use the syntax.\n\n### Valid patterns\n\n### Invalid patterns\n\n### Pattern matching\n\nWhat's next\n-----------\n\n- For a list of the events supported by Eventarc, see [Google event types supported by Eventarc](/eventarc/docs/reference/supported-events)."]]