GCP.Logging reference
BillingBucket
Section titled “BillingBucket”Source:
src/GCP/Logging/BillingBucket.ts
A Cloud Logging log bucket owned by a billing account.
Log buckets have no labels field, so Alchemy stamps ownership into the
description for list / nuke. bucketId, location, and
billingAccountId are identity — changing any replaces the bucket.
Delete marks the bucket DELETE_REQUESTED; GCP purges it after 7 days.
Reconcile undeletes a bucket still in that grace period so the same
name can be reused.
BillingBucket: Creating a Billing Log Bucket
Section titled “BillingBucket: Creating a Billing Log Bucket”Generated name in global
const bucket = yield* GCP.Logging.BillingBucket("AppLogs", { description: "application logs",});Named bucket with custom retention
const bucket = yield* GCP.Logging.BillingBucket("AppLogs", { billingAccountId: "AAAAAA-BBBBBB-CCCCCC", bucketId: "app-logs", location: "global", description: "application logs", retentionDays: 31,});BillingBucket: Updating a Billing Log Bucket
Section titled “BillingBucket: Updating a Billing Log Bucket”const bucket = yield* GCP.Logging.BillingBucket("AppLogs", { location: "global", description: "retained application logs", retentionDays: 60,});BillingBucketsLink
Section titled “BillingBucketsLink”Source:
src/GCP/Logging/BillingBucketsLink.ts
A BigQuery dataset link for a billing-account log bucket.
Creating a link asynchronously provisions a BigQuery dataset (and views
for each log view) so Log Analytics queries can run against the bucket.
A bucket may currently contain only one link. Links have no update API
— they are existence-only after create. Alchemy stamps ownership into
the description at create time for list / nuke. linkId, bucketId,
location, and billingAccountId are identity.
BillingBucketsLink: Creating a Billing Bucket Link
Section titled “BillingBucketsLink: Creating a Billing Bucket Link”Link an analytics-enabled bucket
const bucket = yield* GCP.Logging.BillingBucket("AppLogs", { analyticsEnabled: true,});const link = yield* GCP.Logging.BillingBucketsLink("Analytics", { bucketId: bucket.bucketId, location: bucket.location, billingAccountId: bucket.billingAccountId, description: "log analytics",});Named link
const link = yield* GCP.Logging.BillingBucketsLink("Analytics", { billingAccountId: "AAAAAA-BBBBBB-CCCCCC", location: "global", bucketId: "app-logs", linkId: "app_logs_link",});BillingBucketsView
Section titled “BillingBucketsView”Source:
src/GCP/Logging/BillingBucketsView.ts
A Cloud Logging view over log entries in a billing-account log bucket.
A bucket may contain a maximum of 30 views. Log views have no labels
field, so Alchemy stamps ownership into the description for list /
nuke. viewId, bucketId, location, and billingAccountId are
identity — changing any replaces the view. Filter and description
update in place.
BillingBucketsView: Creating a Billing Bucket View
Section titled “BillingBucketsView: Creating a Billing Bucket View”View of Compute Engine logs
const view = yield* GCP.Logging.BillingBucketsView("Gce", { bucketId: bucket.bucketId, filter: 'resource.type = "gce_instance"', description: "compute logs",});Named view on an explicit billing account
const view = yield* GCP.Logging.BillingBucketsView("Gce", { billingAccountId: "AAAAAA-BBBBBB-CCCCCC", location: "global", bucketId: "app-logs", viewId: "gce-logs", filter: 'resource.type = "gce_instance"',});BillingBucketsView: Updating a Billing Bucket View
Section titled “BillingBucketsView: Updating a Billing Bucket View”const view = yield* GCP.Logging.BillingBucketsView("Gce", { bucketId: bucket.bucketId, location: "global", filter: 'resource.type = "gce_instance" AND severity>=ERROR', description: "compute errors",});BillingExclusion
Section titled “BillingExclusion”Source:
src/GCP/Logging/BillingExclusion.ts
A Cloud Logging exclusion on a billing account _Default sink.
Exclusions drop matching log entries before they are stored in the
_Default bucket (they do not apply to _Required). Logging exclusions
have no labels field, so Alchemy stamps ownership into the description
for list / nuke. Name is identity — changing exclusionId or
billingAccountId replaces the exclusion.
BillingExclusion: Creating a Billing Exclusion
Section titled “BillingExclusion: Creating a Billing Exclusion”Generated name, drop debug logs
const exclusion = yield* GCP.Logging.BillingExclusion("DropDebug", { filter: "severity=DEBUG", description: "drop debug entries",});Named exclusion on an explicit billing account
const exclusion = yield* GCP.Logging.BillingExclusion("DropDebug", { billingAccountId: "AAAAAA-BBBBBB-CCCCCC", exclusionId: "drop-debug", filter: "severity=DEBUG",});BillingExclusion: Updating a Billing Exclusion
Section titled “BillingExclusion: Updating a Billing Exclusion”const exclusion = yield* GCP.Logging.BillingExclusion("DropDebug", { filter: "severity<ERROR", description: "drop non-errors", disabled: true,});BillingSavedQuery
Section titled “BillingSavedQuery”Source:
src/GCP/Logging/BillingSavedQuery.ts
A Cloud Logging saved query owned by a billing account.
Saved queries have no labels field, so Alchemy stamps ownership into
the description for list / nuke. savedQueryId, location, and
billingAccountId are identity — changing any replaces the query.
Display name, description, visibility, and query text update in place.
BillingSavedQuery: Creating a Billing Saved Query
Section titled “BillingSavedQuery: Creating a Billing Saved Query”Logs Explorer error query
const query = yield* GCP.Logging.BillingSavedQuery("Errors", { displayName: "billing errors", loggingQuery: { filter: "severity>=ERROR" }, description: "error entries",});Named shared query
const query = yield* GCP.Logging.BillingSavedQuery("Errors", { billingAccountId: "AAAAAA-BBBBBB-CCCCCC", savedQueryId: "billing-errors", displayName: "billing errors", visibility: "SHARED", loggingQuery: { filter: "severity>=ERROR" },});BillingSavedQuery: Updating a Billing Saved Query
Section titled “BillingSavedQuery: Updating a Billing Saved Query”const query = yield* GCP.Logging.BillingSavedQuery("Errors", { displayName: "billing warnings", loggingQuery: { filter: "severity>=WARNING" }, description: "warnings and errors",});BillingSink
Section titled “BillingSink”Source:
src/GCP/Logging/BillingSink.ts
A Cloud Logging sink that routes billing-account log entries to a destination.
Logging sinks have no labels field, so Alchemy stamps ownership into
the description for list / nuke. Name is identity — changing sinkId
or billingAccountId replaces the sink. Filter, destination,
description, disabled flag, exclusions, and BigQuery options update in
place.
BillingSink: Creating a Billing Sink
Section titled “BillingSink: Creating a Billing Sink”Route errors to the _Default log bucket
const sink = yield* GCP.Logging.BillingSink("Errors", { destination: "logging.googleapis.com/billingAccounts/AAAAAA-BBBBBB-CCCCCC/locations/global/buckets/_Default", filter: "severity>=ERROR",});Named sink with a description
const sink = yield* GCP.Logging.BillingSink("Errors", { sinkId: "app-errors", billingAccountId: "AAAAAA-BBBBBB-CCCCCC", destination: "logging.googleapis.com/billingAccounts/AAAAAA-BBBBBB-CCCCCC/locations/global/buckets/_Default", filter: "severity>=ERROR", description: "application errors",});BillingSink: Updating a Billing Sink
Section titled “BillingSink: Updating a Billing Sink”const sink = yield* GCP.Logging.BillingSink("Errors", { destination: "logging.googleapis.com/billingAccounts/AAAAAA-BBBBBB-CCCCCC/locations/global/buckets/_Default", filter: "severity>=WARNING", description: "warnings and errors", exclusions: [ { name: "drop-healthchecks", filter: 'httpRequest.requestUrl="/healthz"', }, ],});BucketsLink
Section titled “BucketsLink”Source:
src/GCP/Logging/BucketsLink.ts
A Cloud Logging link that creates a BigQuery dataset over an analytics-enabled log bucket.
A bucket may have only one link. Create and delete are long-running
operations; the matching BigQuery dataset is created and deleted with
the link. Links have no update API and no labels field — Alchemy
stamps ownership into the description at create. linkId and the
parent bucket are identity; replacement is delete-first because a
bucket cannot hold two links.
BucketsLink: Creating a Link
Section titled “BucketsLink: Creating a Link”Link an analytics bucket to BigQuery
const bucket = yield* GCP.Logging.LogBucket("AppLogs", { analyticsEnabled: true, description: "analytics logs",});const link = yield* GCP.Logging.BucketsLink("Analytics", { bucket: bucket.name, description: "bigquery analytics",});Named link
const link = yield* GCP.Logging.BucketsLink("Analytics", { bucket: bucket.name, linkId: "app_logs", description: "bigquery analytics",});BucketsView
Section titled “BucketsView”Source:
src/GCP/Logging/BucketsView.ts
A Cloud Logging view over log entries in a log bucket.
A bucket may contain at most 30 views. Log views have no labels field,
so Alchemy stamps ownership into the description for list / nuke.
viewId and the parent bucket are identity — changing either replaces
the view. Filter and description update in place.
BucketsView: Creating a View
Section titled “BucketsView: Creating a View”Generated name over a custom bucket
const bucket = yield* GCP.Logging.LogBucket("AppLogs", { description: "application logs",});const view = yield* GCP.Logging.BucketsView("Stdout", { bucket: bucket.name, filter: 'LOG_ID("stdout")', description: "stdout only",});Named view
const view = yield* GCP.Logging.BucketsView("Stdout", { bucket: bucket.name, viewId: "stdout", filter: 'LOG_ID("stdout")',});BucketsView: Updating a View
Section titled “BucketsView: Updating a View”const view = yield* GCP.Logging.BucketsView("Stdout", { bucket: bucket.name, filter: 'LOG_ID("stderr")', description: "stderr only",});Exclusion
Section titled “Exclusion”Source:
src/GCP/Logging/Exclusion.ts
A Cloud Logging exclusion on the _Default sink.
Exclusions drop matching log entries before they are stored in the
_Default bucket (they do not apply to _Required). A project can have
up to 10. Logging exclusions have no labels field, so Alchemy stamps
ownership into the description for list / nuke. Name is identity —
changing exclusionId replaces the exclusion.
Exclusion: Creating an Exclusion
Section titled “Exclusion: Creating an Exclusion”Generated name, drop debug logs
const exclusion = yield* GCP.Logging.Exclusion("DropDebug", { filter: "severity=DEBUG", description: "drop debug entries",});Named exclusion
const exclusion = yield* GCP.Logging.Exclusion("DropDebug", { exclusionId: "drop-debug", filter: "severity=DEBUG", description: "drop debug entries",});Exclusion: Updating an Exclusion
Section titled “Exclusion: Updating an Exclusion”const exclusion = yield* GCP.Logging.Exclusion("DropDebug", { filter: "severity<ERROR", description: "drop non-errors", disabled: true,});FolderBucket
Section titled “FolderBucket”Source:
src/GCP/Logging/FolderBucket.ts
A Cloud Logging log bucket owned by a folder (or the stack project).
Uses the folder-location Logging APIs (createFoldersLocationsBuckets
and siblings). Log buckets have no labels field, so Alchemy stamps
ownership into the description for list / nuke. folderId, bucketId,
and location are identity — changing any of them replaces the bucket.
Delete marks the bucket DELETE_REQUESTED; GCP purges it after 7 days.
FolderBucket: Creating a Folder Bucket
Section titled “FolderBucket: Creating a Folder Bucket”Generated name in global on the stack project
const bucket = yield* GCP.Logging.FolderBucket("AppLogs", { description: "application logs",});Named bucket on a folder
const bucket = yield* GCP.Logging.FolderBucket("AppLogs", { folderId: "123456789", bucketId: "app-logs", location: "global", description: "application logs", retentionDays: 31,});FolderBucket: Updating a Folder Bucket
Section titled “FolderBucket: Updating a Folder Bucket”const bucket = yield* GCP.Logging.FolderBucket("AppLogs", { location: "global", description: "retained application logs", retentionDays: 60,});FolderBucketsLink
Section titled “FolderBucketsLink”Source:
src/GCP/Logging/FolderBucketsLink.ts
A BigQuery linked dataset for an analytics-enabled folder log bucket.
Create is asynchronous and also provisions a BigQuery dataset whose id
matches linkId. A bucket may currently contain only one link. Links
have no labels field, so Alchemy stamps ownership into the description
for list / nuke. There is no update API — changing linkId,
bucketName, or description replaces the link (delete first).
FolderBucketsLink: Creating a Folder Bucket Link
Section titled “FolderBucketsLink: Creating a Folder Bucket Link”const bucket = yield* GCP.Logging.FolderBucket("Analytics", { analyticsEnabled: true,});const link = yield* GCP.Logging.FolderBucketsLink("Bq", { bucketName: bucket.name, description: "log analytics dataset",});FolderBucketsView
Section titled “FolderBucketsView”Source:
src/GCP/Logging/FolderBucketsView.ts
A Cloud Logging view over log entries in a folder (or project) log bucket.
A bucket may contain at most 30 views. Views have no labels field, so
Alchemy stamps ownership into the description for list / nuke. viewId
and bucketName are identity — changing either replaces the view.
FolderBucketsView: Creating a Folder Bucket View
Section titled “FolderBucketsView: Creating a Folder Bucket View”const bucket = yield* GCP.Logging.FolderBucket("AppLogs", {});const view = yield* GCP.Logging.FolderBucketsView("Errors", { bucketName: bucket.name, filter: "severity>=ERROR", description: "errors only",});FolderBucketsView: Updating a Folder Bucket View
Section titled “FolderBucketsView: Updating a Folder Bucket View”const view = yield* GCP.Logging.FolderBucketsView("Errors", { bucketName: bucket.name, filter: "severity>=WARNING", description: "warnings and errors",});FolderExclusion
Section titled “FolderExclusion”Source:
src/GCP/Logging/FolderExclusion.ts
A Cloud Logging exclusion on a folder _Default sink.
Exclusions drop matching log entries before they are stored in the
_Default bucket (they do not apply to _Required). Folder exclusions
do not apply to child projects. Logging exclusions have no labels field,
so Alchemy stamps ownership into the description for list / nuke.
Name is identity — changing exclusionId or folderId replaces the
exclusion.
FolderExclusion: Creating a Folder Exclusion
Section titled “FolderExclusion: Creating a Folder Exclusion”Generated name, drop debug logs
const exclusion = yield* GCP.Logging.FolderExclusion("DropDebug", { filter: "severity=DEBUG", description: "drop debug entries",});Named exclusion on an explicit folder
const exclusion = yield* GCP.Logging.FolderExclusion("DropDebug", { folderId: "123456789", exclusionId: "drop-debug", filter: "severity=DEBUG",});FolderExclusion: Updating a Folder Exclusion
Section titled “FolderExclusion: Updating a Folder Exclusion”const exclusion = yield* GCP.Logging.FolderExclusion("DropDebug", { filter: "severity<ERROR", description: "drop non-errors", disabled: true,});FolderLogScope
Section titled “FolderLogScope”Source:
src/GCP/Logging/FolderLogScope.ts
A Cloud Logging log scope grouping projects and views to read together.
Log scopes exist only in global. They have no labels field, so Alchemy
stamps ownership into the description for list / nuke. folderId,
logScopeId, and location are identity — changing any of them
replaces the log scope. resourceNames and description update in
place. The _Default log scope cannot be modified or deleted.
FolderLogScope: Creating a Folder Log Scope
Section titled “FolderLogScope: Creating a Folder Log Scope”const scope = yield* GCP.Logging.FolderLogScope("App", { resourceNames: ["projects/my-project"], description: "application logs",});FolderLogScope: Updating a Folder Log Scope
Section titled “FolderLogScope: Updating a Folder Log Scope”const scope = yield* GCP.Logging.FolderLogScope("App", { resourceNames: ["projects/my-project"], description: "updated application logs",});FolderSavedQuery
Section titled “FolderSavedQuery”Source:
src/GCP/Logging/FolderSavedQuery.ts
A Cloud Logging saved query owned by a folder (or the stack project).
Saved queries have no labels field, so Alchemy stamps ownership into
the description for list / nuke. folderId, savedQueryId, and
location are identity — changing any of them replaces the query.
Display name, visibility, description, and query text update in place.
FolderSavedQuery: Creating a Folder Saved Query
Section titled “FolderSavedQuery: Creating a Folder Saved Query”const query = yield* GCP.Logging.FolderSavedQuery("Errors", { displayName: "application errors", visibility: "SHARED", loggingQuery: { filter: "severity>=ERROR" }, description: "error log entries",});FolderSavedQuery: Updating a Folder Saved Query
Section titled “FolderSavedQuery: Updating a Folder Saved Query”const query = yield* GCP.Logging.FolderSavedQuery("Errors", { displayName: "warnings and errors", visibility: "SHARED", loggingQuery: { filter: "severity>=WARNING" }, description: "warning and error log entries",});FolderSink
Section titled “FolderSink”Source:
src/GCP/Logging/FolderSink.ts
A Cloud Logging sink owned by a folder (or the stack project).
Logging sinks have no labels field, so Alchemy stamps ownership into
the description for list / nuke. folderId and sinkId are identity
— changing either replaces the sink. Filter, destination, description,
disabled flag, exclusions, and BigQuery options update in place.
FolderSink: Creating a Folder Sink
Section titled “FolderSink: Creating a Folder Sink”Route errors to the _Default log bucket
const sink = yield* GCP.Logging.FolderSink("Errors", { destination: "logging.googleapis.com/projects/my-project/locations/global/buckets/_Default", filter: "severity>=ERROR",});Folder-owned sink including children
const sink = yield* GCP.Logging.FolderSink("Errors", { folderId: "123456789", destination: "logging.googleapis.com/projects/my-project/locations/global/buckets/_Default", filter: "severity>=ERROR", includeChildren: true, uniqueWriterIdentity: true,});FolderSink: Updating a Folder Sink
Section titled “FolderSink: Updating a Folder Sink”const sink = yield* GCP.Logging.FolderSink("Errors", { destination: "logging.googleapis.com/projects/my-project/locations/global/buckets/_Default", filter: "severity>=WARNING", description: "warnings and errors",});LocationsBucket
Section titled “LocationsBucket”Source:
src/GCP/Logging/LocationsBucket.ts
A Cloud Logging log bucket addressed through the generic locations APIs.
Uses createLocationsBuckets / getLocationsBuckets / deleteLocationsBuckets.
Log buckets have no labels field, so Alchemy stamps ownership into the
description for list / nuke. parent, bucketId, and location are
identity — changing any of them replaces the bucket. Delete marks the
bucket DELETE_REQUESTED; GCP purges it after 7 days.
LocationsBucket: Creating a Locations Bucket
Section titled “LocationsBucket: Creating a Locations Bucket”Generated name in global
const bucket = yield* GCP.Logging.LocationsBucket("AppLogs", { description: "application logs",});Named bucket with custom retention
const bucket = yield* GCP.Logging.LocationsBucket("AppLogs", { bucketId: "app-logs", location: "global", description: "application logs", retentionDays: 31,});LocationsBucket: Updating a Locations Bucket
Section titled “LocationsBucket: Updating a Locations Bucket”const bucket = yield* GCP.Logging.LocationsBucket("AppLogs", { location: "global", description: "retained application logs", retentionDays: 60,});LocationsBucketsLink
Section titled “LocationsBucketsLink”Source:
src/GCP/Logging/LocationsBucketsLink.ts
A BigQuery linked dataset for an analytics-enabled log bucket, managed through the generic locations APIs.
Create is asynchronous and also provisions a BigQuery dataset whose id
matches linkId. A bucket may currently contain only one link. Links
have no labels field, so Alchemy stamps ownership into the description
for list / nuke. There is no update API — changing linkId,
bucketName, or description replaces the link (delete first).
LocationsBucketsLink: Creating a Locations Bucket Link
Section titled “LocationsBucketsLink: Creating a Locations Bucket Link”const bucket = yield* GCP.Logging.LocationsBucket("Analytics", { analyticsEnabled: true,});const link = yield* GCP.Logging.LocationsBucketsLink("Bq", { bucketName: bucket.name, description: "log analytics dataset",});LocationsBucketsView
Section titled “LocationsBucketsView”Source:
src/GCP/Logging/LocationsBucketsView.ts
A Cloud Logging view over log entries in a log bucket, managed through the generic locations APIs.
A bucket may contain at most 30 views. Views have no labels field, so
Alchemy stamps ownership into the description for list / nuke.
viewId and bucketName are identity — changing either replaces the
view.
LocationsBucketsView: Creating a Locations Bucket View
Section titled “LocationsBucketsView: Creating a Locations Bucket View”View over stdout
const bucket = yield* GCP.Logging.LocationsBucket("AppLogs", { description: "application logs",});const view = yield* GCP.Logging.LocationsBucketsView("Stdout", { bucketName: bucket.name, filter: 'LOG_ID("stdout")', description: "stdout only",});Named view
const view = yield* GCP.Logging.LocationsBucketsView("Stdout", { bucketName: bucket.name, viewId: "stdout", filter: 'LOG_ID("stdout")',});LocationsBucketsView: Updating a Locations Bucket View
Section titled “LocationsBucketsView: Updating a Locations Bucket View”const view = yield* GCP.Logging.LocationsBucketsView("Stdout", { bucketName: bucket.name, filter: 'LOG_ID("stderr")', description: "stderr only",});LogBucket
Section titled “LogBucket”Source:
src/GCP/Logging/LogBucket.ts
A Cloud Logging log bucket that stores log entries in a location.
Log buckets have no labels field, so Alchemy stamps ownership into the
description for list / nuke. bucketId and location are identity —
changing either replaces the bucket. Delete marks the bucket
DELETE_REQUESTED; GCP purges it after 7 days. Reconcile undeletes a
bucket still in that grace period so the same name can be reused.
LogBucket: Creating a Log Bucket
Section titled “LogBucket: Creating a Log Bucket”Generated name in global
const bucket = yield* GCP.Logging.LogBucket("AppLogs", { description: "application logs",});Named bucket with custom retention
const bucket = yield* GCP.Logging.LogBucket("AppLogs", { bucketId: "app-logs", location: "global", description: "application logs", retentionDays: 31,});LogBucket: Updating a Log Bucket
Section titled “LogBucket: Updating a Log Bucket”const bucket = yield* GCP.Logging.LogBucket("AppLogs", { location: "global", description: "retained application logs", retentionDays: 60,});LogScope
Section titled “LogScope”Source:
src/GCP/Logging/LogScope.ts
A Cloud Logging log scope — a named collection of projects and log views to query together.
Log scopes exist only in the global location. They have no labels
field, so Alchemy stamps ownership into the description for list /
nuke. logScopeId and location are identity — changing either
replaces the scope. resourceNames and description update in place.
LogScope: Creating a Log Scope
Section titled “LogScope: Creating a Log Scope”Generated name covering this project
const scope = yield* GCP.Logging.LogScope("App", { resourceNames: ["projects/my-project"], description: "application logs",});Named scope
const scope = yield* GCP.Logging.LogScope("App", { logScopeId: "app-logs", resourceNames: ["projects/my-project"],});LogScope: Updating a Log Scope
Section titled “LogScope: Updating a Log Scope”const scope = yield* GCP.Logging.LogScope("App", { resourceNames: ["projects/my-project"], description: "all application logs",});Metric
Section titled “Metric”Source:
src/GCP/Logging/Metric.ts
A Cloud Logging logs-based metric.
Cloud Logging metrics have no resource labels. Alchemy stamps ownership
into the description ([alchemy alchemy-stack=… alchemy-stage=… alchemy-id=…]) so list / pnpm nuke:gcp can find them.
metricId, metricDescriptor.metricKind, and
metricDescriptor.valueType are immutable — changing them replaces the
metric.
Metric: Creating a Metric
Section titled “Metric: Creating a Metric”Generated name, error counter
const errors = yield* GCP.Logging.Metric("Errors", { filter: "severity>=ERROR", description: "count error log entries",});Explicit id, disabled counter
const warnings = yield* GCP.Logging.Metric("Warnings", { metricId: "app-warnings", filter: "severity>=WARNING", description: "count warning log entries", disabled: true,});Metric: Distribution Metrics
Section titled “Metric: Distribution Metrics”const latency = yield* GCP.Logging.Metric("Latency", { filter: "jsonPayload.latency > 0", valueExtractor: "EXTRACT(jsonPayload.latency)", metricDescriptor: { metricKind: "DELTA", valueType: "DISTRIBUTION", }, bucketOptions: { exponentialBuckets: { numFiniteBuckets: 8, growthFactor: 2, scale: 1, }, },});OrganizationBucketsLink
Section titled “OrganizationBucketsLink”Source:
src/GCP/Logging/OrganizationBucketsLink.ts
A BigQuery dataset link for an organization Cloud Logging bucket.
Analytics must be enabled on the parent bucket. A bucket may contain
only one link. Links have no labels field, so Alchemy stamps
ownership into the description for list / nuke. The API has no
update method — linkId, organization, and bucket are identity.
OrganizationBucketsLink: Creating an Organization Bucket Link
Section titled “OrganizationBucketsLink: Creating an Organization Bucket Link”const bucket = yield* GCP.Logging.OrganizationLogBucket("Analytics", { analyticsEnabled: true,});const link = yield* GCP.Logging.OrganizationBucketsLink("Bq", { bucket: bucket.name, description: "log analytics dataset",});OrganizationBucketsView
Section titled “OrganizationBucketsView”Source:
src/GCP/Logging/OrganizationBucketsView.ts
A Cloud Logging view over log entries in an organization log bucket.
Views have no labels field, so Alchemy stamps ownership into the
description for list / nuke. viewId, organization, and the parent
bucket are identity — changing any replaces the view.
OrganizationBucketsView: Creating an Organization View
Section titled “OrganizationBucketsView: Creating an Organization View”View on the organization _Default bucket
const view = yield* GCP.Logging.OrganizationBucketsView("Errors", { filter: 'resource.type = "gce_instance"', description: "compute instance logs",});Named view on a custom organization bucket
const view = yield* GCP.Logging.OrganizationBucketsView("Errors", { viewId: "app-errors", bucket: bucket.name, filter: 'resource.type = "gce_instance"',});OrganizationBucketsView: Updating an Organization View
Section titled “OrganizationBucketsView: Updating an Organization View”const view = yield* GCP.Logging.OrganizationBucketsView("Errors", { bucket: bucket.name, filter: 'resource.type = "gce_instance" AND LOG_ID("syslog")', description: "syslog from compute",});OrganizationExclusion
Section titled “OrganizationExclusion”Source:
src/GCP/Logging/OrganizationExclusion.ts
A Cloud Logging exclusion on an organization’s _Default sink.
Exclusions drop matching log entries before they are stored in the
organization’s _Default bucket (they do not apply to _Required).
An organization can have up to 10. Logging exclusions have no labels
field, so Alchemy stamps ownership into the description for list /
nuke. Name and organization are identity — changing either replaces
the exclusion.
OrganizationExclusion: Creating an Organization Exclusion
Section titled “OrganizationExclusion: Creating an Organization Exclusion”Generated name, drop debug logs
const exclusion = yield* GCP.Logging.OrganizationExclusion("DropDebug", { filter: "severity=DEBUG", description: "drop debug entries",});Named exclusion on an explicit organization
const exclusion = yield* GCP.Logging.OrganizationExclusion("DropDebug", { organization: "organizations/123456789", exclusionId: "drop-debug", filter: "severity=DEBUG",});OrganizationExclusion: Updating an Organization Exclusion
Section titled “OrganizationExclusion: Updating an Organization Exclusion”const exclusion = yield* GCP.Logging.OrganizationExclusion("DropDebug", { organization: "organizations/123456789", filter: "severity<ERROR", description: "drop non-errors", disabled: true,});OrganizationLogBucket
Section titled “OrganizationLogBucket”Source:
src/GCP/Logging/OrganizationLogBucket.ts
A Cloud Logging log bucket on an organization.
Log buckets have no labels field, so Alchemy stamps ownership into the
description for list / nuke. bucketId, location, and organization
are identity — changing any replaces the bucket. Delete marks the
bucket DELETE_REQUESTED; GCP purges it after 7 days. Reconcile
undeletes a bucket still in that grace period so the same name can be
reused.
OrganizationLogBucket: Creating an Organization Log Bucket
Section titled “OrganizationLogBucket: Creating an Organization Log Bucket”Generated name in global
const bucket = yield* GCP.Logging.OrganizationLogBucket("AppLogs", { description: "organization application logs",});Named bucket with custom retention
const bucket = yield* GCP.Logging.OrganizationLogBucket("AppLogs", { organization: "organizations/123456789", bucketId: "app-logs", location: "global", description: "application logs", retentionDays: 31,});OrganizationLogBucket: Updating an Organization Log Bucket
Section titled “OrganizationLogBucket: Updating an Organization Log Bucket”const bucket = yield* GCP.Logging.OrganizationLogBucket("AppLogs", { location: "global", organization: "organizations/123456789", description: "retained application logs", retentionDays: 60,});OrganizationLogScope
Section titled “OrganizationLogScope”Source:
src/GCP/Logging/OrganizationLogScope.ts
A Cloud Logging log scope on an organization.
A log scope groups projects (and views) to read logs from. Log scopes
exist only in the global location. They have no labels field, so
Alchemy stamps ownership into the description for list / nuke.
logScopeId, organization, and location are identity.
OrganizationLogScope: Creating an Organization Log Scope
Section titled “OrganizationLogScope: Creating an Organization Log Scope”Scope the current project
const scope = yield* GCP.Logging.OrganizationLogScope("App", { description: "application projects",});Named scope with explicit resources
const scope = yield* GCP.Logging.OrganizationLogScope("App", { logScopeId: "app-scope", resourceNames: ["projects/my-project"], description: "application projects",});OrganizationLogScope: Updating an Organization Log Scope
Section titled “OrganizationLogScope: Updating an Organization Log Scope”const scope = yield* GCP.Logging.OrganizationLogScope("App", { resourceNames: ["projects/my-project", "projects/other"], description: "two application projects",});OrganizationSavedQuery
Section titled “OrganizationSavedQuery”Source:
src/GCP/Logging/OrganizationSavedQuery.ts
A Cloud Logging saved query on an organization.
Saved queries have no labels field, so Alchemy stamps ownership into
the description for list / nuke. savedQueryId, organization, and
location are identity — changing any replaces the query.
OrganizationSavedQuery: Creating an Organization Saved Query
Section titled “OrganizationSavedQuery: Creating an Organization Saved Query”Generated name
const query = yield* GCP.Logging.OrganizationSavedQuery("Errors", { displayName: "org errors", loggingQuery: { filter: "severity>=ERROR" }, description: "organization errors",});Named shared query
const query = yield* GCP.Logging.OrganizationSavedQuery("Errors", { savedQueryId: "org-errors", visibility: "SHARED", loggingQuery: { filter: "severity>=ERROR" },});OrganizationSavedQuery: Updating an Organization Saved Query
Section titled “OrganizationSavedQuery: Updating an Organization Saved Query”const query = yield* GCP.Logging.OrganizationSavedQuery("Errors", { displayName: "org warnings", loggingQuery: { filter: "severity>=WARNING" }, description: "warnings and errors",});OrganizationSink
Section titled “OrganizationSink”Source:
src/GCP/Logging/OrganizationSink.ts
A Cloud Logging sink that routes organization log entries to a destination.
Logging sinks have no labels field, so Alchemy stamps ownership into
the description for list / nuke. Name and organization are identity
— changing sinkId or organization replaces the sink. Filter,
destination, description, disabled flag, exclusions, and BigQuery
options update in place.
OrganizationSink: Creating an Organization Sink
Section titled “OrganizationSink: Creating an Organization Sink”Route errors to the organization _Default log bucket
const sink = yield* GCP.Logging.OrganizationSink("Errors", { destination: "logging.googleapis.com/organizations/123456789/locations/global/buckets/_Default", filter: "severity>=ERROR",});Named sink that includes child projects
const sink = yield* GCP.Logging.OrganizationSink("Errors", { sinkId: "app-errors", destination: "logging.googleapis.com/organizations/123456789/locations/global/buckets/_Default", filter: "severity>=ERROR", includeChildren: true, description: "application errors",});OrganizationSink: Updating an Organization Sink
Section titled “OrganizationSink: Updating an Organization Sink”const sink = yield* GCP.Logging.OrganizationSink("Errors", { destination: "logging.googleapis.com/organizations/123456789/locations/global/buckets/_Default", filter: "severity>=WARNING", description: "warnings and errors", exclusions: [ { name: "drop-healthchecks", filter: 'httpRequest.requestUrl="/healthz"', }, ],});SavedQuery
Section titled “SavedQuery”Source:
src/GCP/Logging/SavedQuery.ts
A Cloud Logging saved query for Logs Explorer or Log Analytics.
Saved queries have no labels field, so Alchemy stamps ownership into
the description for list / nuke. savedQueryId and location are
identity — changing either replaces the query. Display name, visibility,
description, and query body update in place.
SavedQuery: Creating a Saved Query
Section titled “SavedQuery: Creating a Saved Query”Generated name, private Logs Explorer query
const query = yield* GCP.Logging.SavedQuery("Errors", { displayName: "application errors", loggingQuery: { filter: "severity>=ERROR" },});Named shared query
const query = yield* GCP.Logging.SavedQuery("Errors", { savedQueryId: "app-errors", displayName: "application errors", visibility: "SHARED", loggingQuery: { filter: "severity>=ERROR" },});SavedQuery: Updating a Saved Query
Section titled “SavedQuery: Updating a Saved Query”const query = yield* GCP.Logging.SavedQuery("Errors", { displayName: "warnings and errors", loggingQuery: { filter: "severity>=WARNING" },});Source:
src/GCP/Logging/Sink.ts
A Cloud Logging sink that routes log entries to a destination.
Logging sinks have no labels field, so Alchemy stamps ownership into
the description for list / nuke. Name is identity — changing sinkId
replaces the sink. Filter, destination, description, disabled flag,
exclusions, and BigQuery options update in place.
Sink: Creating a Sink
Section titled “Sink: Creating a Sink”Route errors to the _Default log bucket
const sink = yield* GCP.Logging.Sink("Errors", { destination: "logging.googleapis.com/projects/my-project/locations/global/buckets/_Default", filter: "severity>=ERROR",});Named sink with a description
const sink = yield* GCP.Logging.Sink("Errors", { sinkId: "app-errors", destination: "logging.googleapis.com/projects/my-project/locations/global/buckets/_Default", filter: "severity>=ERROR", description: "application errors",});Sink: Updating a Sink
Section titled “Sink: Updating a Sink”const sink = yield* GCP.Logging.Sink("Errors", { destination: "logging.googleapis.com/projects/my-project/locations/global/buckets/_Default", filter: "severity>=WARNING", description: "warnings and errors", exclusions: [ { name: "drop-healthchecks", filter: 'httpRequest.requestUrl="/healthz"', }, ],});