Searches
rainlytics searches counts search terms recorded in CloudFront access logs. Use it for a search
endpoint that puts the term in a query-string parameter:
rainlytics searches --path /search/ --last 30dterm searches redirected-------- -------- ----------rain 41 38weather 12 0CloudFront records the query string for cached and uncached requests. Rainlytics reads the term but does not include the viewer address in the result.
Name the search path and parameter
Section titled “Name the search path and parameter”Specify the search endpoint with --path and the query-string parameter with --param. The path
filter excludes unrelated requests that happen to use the same parameter name.
rainlytics searches --path /search/ --param q --last 30drainlytics searches --path /tools/convert/ --param text --last 30d--param defaults to q.
Repeat --path for several search pages:
rainlytics searches \ --path /docs/search/ \ --path /api/search/ \ --last 30dThe result then includes a section column. If prefixes overlap, the first matching path on the
command line wins.
Redirected searches
Section titled “Redirected searches”redirected counts searches that returned status 302, 303 or 307 by default. For example, a
search endpoint may redirect an exact match directly to the matching page.
Permanent redirects are omitted because canonical URL redirects can count one search twice. Change the statuses when your search endpoint uses another response:
rainlytics searches \ --path /search/ \ --redirect-status 301,302 \ --last 30dIf successful searches and searches with no results both return 200, this rollup cannot tell them apart. Use a different status or path if you need to measure that distinction.
Stored searches
Section titled “Stored searches”Configure the scheduled question with the same path and parameter:
new RollupSummaries(this, "Summaries", { table, workgroup, requests: { searches: { paths: ["/search/"], param: "q" }, },});A command that omits --path and --param adopts the values recorded in the stored summaries. A
different value requires --query.
CloudFront encodes the browser’s query string again when writing the log. The rollup extracts the
parameter and decodes the term once more. Form + and URL %20 spaces therefore group together.
