Documentation
¶
Overview ¶
Package accesslog writes proxy activity as JSON Lines.
Index ¶
Constants ¶
View Source
const ( // EventRequest identifies the response sent by the proxy to a client. EventRequest = "request" // EventUpstream identifies one HTTP exchange with an upstream service. EventUpstream = "upstream" )
Variables ¶
This section is empty.
Functions ¶
func URLWithoutSecrets ¶
URLWithoutSecrets returns a URL without user information, query values, or fragments.
Types ¶
type Entry ¶
type Entry struct {
Time time.Time `json:"time"`
Event string `json:"event"`
RequestID string `json:"request_id,omitempty"`
Method string `json:"method"`
Path string `json:"path,omitempty"`
URL string `json:"url,omitempty"`
StatusCode int `json:"status_code,omitempty"`
DurationMS int64 `json:"duration_ms"`
RemoteAddr string `json:"remote_addr,omitempty"`
// RemoteIP is the address the request is attributed to: the TCP peer, or
// the leftmost X-Forwarded-For entry when that header is trusted.
RemoteIP string `json:"remote_ip,omitempty"`
// UserAgent is recorded verbatim; Client is it reduced to a known tool
// name, so log queries can group without parsing.
UserAgent string `json:"user_agent,omitempty"`
Client string `json:"client,omitempty"`
Ecosystem string `json:"ecosystem,omitempty"`
// Bytes is always emitted, including as 0, so a log pipeline summing the
// field does not have to treat a bodyless response as null.
Bytes int64 `json:"bytes"`
Error string `json:"error,omitempty"`
}
Entry is one proxy activity record.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger appends complete JSON objects to a file, one per line.
Click to show internal directories.
Click to hide internal directories.