Rankly reads your Google Cloud request logs through a Log Sink and a Pub/Sub push subscription. One block in Cloud Shell wires it up. It picks up Cloud Run, HTTP Load Balancer, and App Engine logs.
Prerequisites. A GCP project with request logging, and a verified domain in Rankly. Your ingest token is baked into the script Rankly generates.

Setup

1

Run the wiring block in Cloud Shell

Open Cloud Shell (or any shell with gcloud authenticated) and paste the block Rankly generates. It creates a Pub/Sub topic, a Log Sink that filters to agent traffic, and a push subscription that delivers to Rankly. It is idempotent.
rankly-gcp-setup.sh
set -euo pipefail
PROJECT_ID="your-project"
INGEST_URL="https://ingest.tryrankly.com/ingest/gcp-logsink"
TENANT_TOKEN="tnt_your_token"
TOPIC="rankly-aa-<token>-logs"
SUB="rankly-aa-<token>-push"
SINK="rankly-aa-<token>-sink"

gcloud config set project "$PROJECT_ID"
gcloud services enable pubsub.googleapis.com logging.googleapis.com
gcloud pubsub topics create "$TOPIC" 2>/dev/null || true

# Log Sink: filter to AI-bot UAs, favicon fetches, and LLM-referred humans
FILTER='(resource.type="cloud_run_revision" OR resource.type="http_load_balancer" OR resource.type="gae_app") AND (httpRequest.userAgent:("GPTBot" OR "ClaudeBot" OR "PerplexityBot" OR "Google-Extended" OR "Bytespider" OR "Amazonbot") OR httpRequest.requestUrl:("/favicon") OR httpRequest.referer:("chatgpt.com" OR "perplexity.ai" OR "claude.ai"))'
SINK_DEST="pubsub.googleapis.com/projects/$PROJECT_ID/topics/$TOPIC"
gcloud logging sinks create "$SINK" "$SINK_DEST" --log-filter="$FILTER" 2>/dev/null \
  || gcloud logging sinks update "$SINK" "$SINK_DEST" --log-filter="$FILTER"

SINK_SA=$(gcloud logging sinks describe "$SINK" --format='value(writerIdentity)')
gcloud pubsub topics add-iam-policy-binding "$TOPIC" --member="$SINK_SA" --role=roles/pubsub.publisher

gcloud pubsub subscriptions create "$SUB" \
  --topic="$TOPIC" --push-endpoint="$INGEST_URL?tenant=$TENANT_TOKEN" \
  --ack-deadline=30 --message-retention-duration=7d 2>/dev/null \
  || gcloud pubsub subscriptions update "$SUB" --push-endpoint="$INGEST_URL?tenant=$TENANT_TOKEN"
Replace your-project with your project ID before running.
2

Send a test request

curl -A "GPTBot/1.0" https://your-domain.com/
Events appear in Rankly within about a minute.
Real client IP behind a proxy. Cloud Run and Load Balancer logs record the IP that hit GCP. If your site sits behind Cloudflare or another proxy, that is the proxy’s IP, not the agent’s, and IP verification cannot confirm vendors.Fix: have your app log the real IP (from CF-Connecting-IP or the first X-Forwarded-For hop) into a jsonPayload field named cfConnectingIp, clientIp, or xForwardedFor. Rankly reads it automatically. If you cannot change the app, use the Cloudflare Worker integration instead, which captures the real IP at the edge.