Skip to content

Commit

Permalink
create audit log sink (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
bolyachevets authored Jan 8, 2025
1 parent 1898d23 commit a536f4f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gcp/project_setup/gcp_cloudsql_instance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ gcloud config set project "${TARGET_PROJECT_ID}-${ENV}"

gcloud services enable servicenetworking.googleapis.com --project="${TARGET_PROJECT_ID}-${ENV}"

# create the dataset only once
# bq mk --location=$REGION --dataset ${HOST_PROJECT_ID}-${ENV}:cloudsql_audit_logs_${TAG}

gcloud logging sinks create cloudsql_audit_logs_${TAG} \
bigquery.googleapis.com/projects/${HOST_PROJECT_ID}-${ENV}/datasets/cloudsql_audit_logs_${TAG} \
--log-filter="logName=\"projects/${TARGET_PROJECT_ID}-${ENV}/logs/cloudaudit.googleapis.com%2Fdata_access\" AND resource.type=\"cloudsql_database\" AND protoPayload.serviceName=\"cloudsql.googleapis.com\" AND protoPayload.methodName=\"cloudsql.instances.query\"" \
--use-partitioned-tables

gcloud sql instances create "${INSTANCE_NAME}-${TAG}" \
--database-version=$POSTGRES_VERSION \
--region=$REGION \
Expand Down

0 comments on commit a536f4f

Please sign in to comment.