These snippets target the A2WF v1.1.0-draft.2 specification (Editor's Draft, not stable).

A2WF Logger Snippets

Logger Snippets

Drop-in server snippets that record which AI agents fetch your A2WF policy. Privacy-preserving by default: no IP, no cookies, no query strings, no full Referer, no raw User-Agent. Optional opt-in forwarding to an operator-configured endpoint.

Pick the snippet for your stack

nginx

JSON-formatted access log directive for nginx. Drop into your server {} block.

Apache

CustomLog + LogFormat directives for Apache 2.4+. Drop into your virtual host config.

Cloudflare Worker

Transparent passthrough worker that proxies the A2WF document and records each fetch.

Express.js

Node.js middleware that emits one JSON line per request. Optional async forwarding.

WordPress / PHP

Drop-in PHP function that hooks into init. Recommends a dedicated log file.

Supporting files

What gets logged

Every snippet writes records that match the same log event schema:

{
  "a2wfLogVersion": "1.0",
  "schemaURI": "https://a2wf.org/schema/a2wf-log-event-v1.json",
  "timestamp": "2026-05-17T10:30:00Z",
  "method": "GET",
  "observedPath": "/.well-known/a2wf/siteai.json",
  "statusCode": 200,
  "userAgentCategory": "openai",
  "matchedSignatureId": "openai-gptbot",
  "agentDeclared": false,
  "agentVerified": false,
  "collectionMode": "local",
  "rawFieldsIncluded": []
}

Privacy posture

Retention

The snippets do not enforce a retention period. A reasonable starting point for operators without a specific regulatory constraint is 90 days with daily rotation. Operators in regulated sectors should align retention with their sector's requirements.