BigQuery Log File Analyzer
Analyzes raw server and CDN access logs stored in BigQuery to quantify Googlebot crawl behavior, surface crawl-budget w…
Updated
About this skill
BigQuery Log File Analyzer is a Analytics and Rank Tracking skill for AI agents, published in the seoskills.sh catalog. Reach for it when your work involves gA4, Search Console, event tracking, and rank monitoring. Install it with one command and it runs inside your own agent, so the work happens in your workflow, not a separate SEO tool.
SKILL.md
BigQuery Log File Analyzer
AGENT ROLE: Autonomous crawl-analytics agent. You operate over a BigQuery logs table. Resolve the schema, run the parameterized query in scripts/googlebot_crawl_analysis.sql, and emit the JSON contract in references/output.schema.json. Never SELECT * on a raw logs table — always project and aggregate.
OBJECTIVE
Classify verified Googlebot requests over a window and report: crawl volume by status class, top wasted-crawl paths (non-200, non-indexable, parameterized), orphaned crawls (crawled but absent from the supplied sitemap set), and high-priority URLs under-crawled relative to their importance.
INPUTS
project(REQUIRED): GCP project id for billing/jobs.logs_table(REQUIRED): fully-qualifiedproject.dataset.tableholding access logs.column_map(REQUIRED): map logical fields → actual columns, e.g.{ "ts":"timestamp", "path":"cs_uri_stem", "status":"sc_status", "ua":"cs_user_agent", "ip":"c_ip", "bytes":"sc_bytes" }.window_days(OPTIONAL, default 30).sitemap_urls(OPTIONAL): array of indexable path strings for orphan detection.priority_paths(OPTIONAL): array of{path_prefix, weight}for under-crawl scoring.
AUTHENTICATION (BigQuery)
- REQUIRE
GOOGLE_APPLICATION_CREDENTIALS(service-account key).- IF unset THEN STOP
error.code="AUTH_MISSING_CREDENTIALS".
- IF unset THEN STOP
- Service account MUST hold
roles/bigquery.jobUseron{project}ANDroles/bigquery.dataVieweron the dataset of{logs_table}.- IF query returns
403 accessDeniedTHEN STOPerror.code="AUTH_NO_BQ_ACCESS"naming the missing role.
- IF query returns
- Execute via BigQuery API
jobs.query(orbq query --use_legacy_sql=false). ALWAYS passmaximumBytesBilled=10 * 2^30(10 GiB) as a cost guard.- IF the job would exceed that THEN STOP
error.code="COST_GUARD_TRIPPED"and report the dry-run byte estimate; instruct the user to narrowwindow_daysor add a partition filter.
- IF the job would exceed that THEN STOP
GOOGLEBOT VERIFICATION (do NOT trust user-agent alone)
- Primary filter:
ua LIKE '%Googlebot%'. - Verification: Googlebot originates from published ranges. IF the logs table lacks a trustworthy verified-bot column THEN treat UA-only matches as
unverifiedand setverification="ua_only"in output; DO NOT silently claim verified. IF reverse-DNS enrichment is available, keep only IPs whose PTR ends in.googlebot.comor.google.comand forward-confirms.
EXPECTED TOOL CALLS
- DRY RUN first: submit the query with
dryRun=true; readtotalBytesProcessed. Enforce the cost guard. - Resolve schema:
GETtable metadata (tables.get) to confirm everycolumn_mapvalue exists. IF a mapped column is missing THEN STOPerror.code="COLUMN_MAP_INVALID"listing the missing keys. - Execute
scripts/googlebot_crawl_analysis.sqlwith query parameters (@window_days,@sitemap,@priority). Parameterize — never string-concatenate user input into SQL.
PROCEDURE
STEP 1 — Bind params, dry-run, cost-check, execute. STEP 2 — From the result rollups compute:
status_breakdown: request counts by class 2xx/3xx/4xx/5xx and the wasted ratio =(3xx+4xx+5xx)/total.wasted_paths: top 20 non-200 or parameterized paths by hits.orphaned: paths with Googlebot hits whose normalized form is NOT insitemap_urls(only if provided).under_crawled: for eachpriority_pathsprefix,crawl_rate = hits / days; flag IFcrawl_rate < 1for weight ≥ 0.7. STEP 3 — Emit JSON per schema, sorted by impact.
RATE LIMITS & ERROR HANDLING
- BigQuery: 429/
rateLimitExceeded→ exponential backoff (2^attempt, max 5) then STOPerror.code="RATE_LIMITED". quotaExceeded(concurrent queries) → wait 10s, retry up to 3.- Long jobs: poll
jobs.getevery 2s up to 120s; IF still running THEN return partialstatus="timeout"withjob_idfor later retrieval.
MISSING / INSUFFICIENT DATA
- IF
window_daysyields 0 Googlebot rows THENstatus="no_googlebot_traffic"; return empty arrays, do not error. - IF
sitemap_urlsabsent THEN omitorphanedand setorphan_analysis="skipped_no_sitemap". - IF logs lack a status or path column THEN STOP
COLUMN_MAP_INVALID; these are mandatory.
OUTPUT
One JSON object validating references/output.schema.json. No prose.
FILES
scripts/googlebot_crawl_analysis.sql— parameterized BigQuery Standard SQL.references/output.schema.json— output contract.
Not using the CLI? Copy the SKILL.md and paste it straight into ChatGPT, Claude, or any agent.
Embed a badge
Install into your agent
More in Analytics and Rank Tracking
GA4 Anomaly Detector
Detects statistically significant anomalies in GA4 organic traffic and conversions by pulling daily metrics from the GA…
GA4 Attribution Path Modeler
Reconstructs multi-touch conversion paths from the event-level GA4 BigQuery export and assigns credit across channels w…
Striking Distance Opportunity Finder
Surfaces "striking distance" keywords ranking in Search Console positions 11-20 with real impression demand, ranks them…
Search Console Cannibalization Analyzer
Detects keyword cannibalization by pulling query-and-page data from the Google Search Console API and clustering querie…