Wiki: Get details for 404/Websites / Privacy Sensitive Analytics



Listing 404 Details

The ability to report on 404s was introduced into pfanalytics in websites/privacy-sensitive-analytics#11

List 404s for domain

domain = "www.bentasker.co.uk"

from(bucket: "telegraf/autogen")
  |> range(start: v.timeRangeStart)
  |> filter(fn: (r) => r._measurement == "pf_analytics_test_404s")
  |> filter(fn: (r) => r.domain == domain)
  |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
  |> keep(columns: ["_time","domain","page","referrer_domain","referrer"])
  |> group()

List 404s by domain and page

import "strings"

domain = "www.bentasker.co.uk"
page = "/bentest/"

from(bucket: "telegraf/autogen")
  |> range(start: v.timeRangeStart)
  |> filter(fn: (r) => r._measurement == "pf_analytics_test_404s")
  |> filter(fn: (r) => r.domain == domain)
  |> filter(fn: (r) => strings.containsStr(v: r.page, substr: page))  
  |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
  |> keep(columns: ["_time","domain","page","referrer_domain","referrer"])
  |> group()