package report // reportTemplate is the HTML template for a single report (either the only // report, or one day's report in --split-by-day mode). Its stylesheet and // chart/map colors are supplied at render time via the active theme // (see themes.go and GenerateHTML). const reportTemplate = ` nxstats — Nginx Report{{if .DayTitle}} · {{.DayTitle}}{{end}} {{if .GeoLocations}} {{end}}

// nxstats //

nginx log analysis report{{if .DayTitle}} — {{.DayTitle}}{{end}} — generated {{.GeneratedAt.Format "2006-01-02 15:04:05 UTC"}}
{{if .IndexFile}} {{end}}
Total Requests
{{.TotalRequests}}
Unique IPs
{{.UniqueIPs}}
Total Bytes
{{formatBytes .TotalBytes}}
Error Rate
{{formatFloat .ErrorRate}}%

// Charts

Status Code Distribution

Top 10 Paths

Requests per Hour

{{if .GeoLocations}}

// Geographic Distribution

{{end}}

// Top IPs

{{range $i, $ip := .TopIPs}} {{end}}
#IP AddressRequests
{{add $i 1}} {{$ip.IP}} {{$ip.Count}}

// Top Paths

{{range $i, $p := .TopPaths}} {{end}}
#PathRequestsTop Status
{{add $i 1}} {{$p.Path}} {{$p.Count}} {{statusBadge $p.TopStatus}}

// Access Log

TimeIPMethodPathStatusBytesUser Agent

// Error Log

TimeLevelPIDConnMessage
` // indexTemplate is the HTML template for the index page generated by // --split-by-day. It lists all daily reports with aggregate stats. Its // stylesheet is supplied at render time via the active theme (see // themes.go and GenerateIndexHTML); .day-link and .err-* rules live in // each theme's shared CSS block. const indexTemplate = ` nxstats — Daily Index

// nxstats //

daily index — generated {{.GeneratedAt.Format "2006-01-02 15:04:05 UTC"}}
Total Requests
{{.TotalRequests}}
Unique IPs
{{.TotalUniqueIPs}}
Total Bytes
{{formatBytes .TotalBytes}}
Overall Error Rate
{{formatFloat .OverallErrorRate}}%
Days Covered
{{len .Days}}

// Daily Breakdown

{{range .Days}} {{end}}
Date Requests Unique IPs Bytes Error Rate
{{fmtDate .Date}} {{.Requests}} {{.UniqueIPs}} {{formatBytes .TotalBytes}} {{formatFloat .ErrorRate}}%
`