Documentation ¶
Index ¶
- Variables
- type Channel
- type Line
- type LineRequest
- type Lines
- func (ll *Lines) Clear()
- func (ll Lines) ClearBefore(t time.Time) Lines
- func (ll *Lines) ErrorCode4XX() int
- func (ll *Lines) ErrorCode5XX() int
- func (ll Lines) Len() int
- func (ll Lines) Less(i, j int) bool
- func (ll *Lines) MostActiveUser() (string, int)
- func (ll *Lines) SectionWithMostHits() (string, int)
- func (ll Lines) Swap(i, j int)
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidLine = errors.New("Invalid Line")
ErrInvalidLine is the error if the line supplied did not match the regex
Functions ¶
This section is empty.
Types ¶
type Line ¶
type Line struct { IPAddress string Identity string UserID string Date time.Time Request LineRequest StatusCode int Size int }
Line is a data structure that holds parsed information about a w3c-formatted HTTP access log (https://en.wikipedia.org/wiki/Common_Log_Format)
type LineRequest ¶
LineRequest is the portion of the log line which contains request line from the client. It includes method of the request, the resource requested, and the HTTP protocol.
func NewLineRequest ¶
func NewLineRequest(raw string) *LineRequest
NewLineRequest returns a LineRequest from a raw string
func (*LineRequest) Section ¶
func (lr *LineRequest) Section() (string, error)
Section returns what's before the second '/' in the URL's path. For example, the section for "http://my.site.com/pages/create” is "http://my.site.com/pages".
func (*LineRequest) String ¶
func (lr *LineRequest) String() string
type Lines ¶
type Lines []Line
Lines is a typalias for a list so methods can be used against it
func (Lines) ClearBefore ¶
ClearBefore returns a new Lines with all entries with a date before time t removed TODO: clear in place
func (*Lines) ErrorCode4XX ¶
ErrorCode4XX returns the number of logs that have an error code 4xx
func (*Lines) ErrorCode5XX ¶
ErrorCode5XX returns the number of logs that have an error code 5xx
func (*Lines) MostActiveUser ¶
MostActiveUser returns the user with the most requests and the number of requests
func (*Lines) SectionWithMostHits ¶
SectionWithMostHits returns the request section that has the largest occurrence and the number of time it appears (hits)