logscan

package
v2.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2022 License: EUPL-1.2, ISC, MIT, + 1 more Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Combined format; used by default in Apache, nginx.
	//
	// 127.0.0.1    user -  [10/Oct/2000:13:55:36 -0700] "GET     /path HTTP/1.1" 200     2326  "https://ref" "Mozilla/5.0"
	// $remote_addr $ignore [$datetime]                  "$method $path $http"    $status $size "$referrer"   "$user_agent"
	Combined      = `$remote_addr $ignore [$datetime] "$method $path $http" $status $size "$referrer" "$user_agent"`
	CombinedVhost = `$host:` + Combined

	// Common log format.
	//
	// 127.0.0.1    user -  [10/Oct/2000:13:55:36 -0700] "GET     /path HTTP/1.1" 200     2326
	// $remote_addr $ignore [$datetime]                  "$method $path $http"    $status $size`
	Common      = `$remote_addr $ignore [$datetime] "$method $path $http" $status $size`
	CommonVhost = `$host:` + Common
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Line

type Line map[string]string

func (Line) ContentType

func (l Line) ContentType() string

func (Line) Datetime

func (l Line) Datetime(scan *Scanner) (time.Time, error)

func (Line) HTTP

func (l Line) HTTP() string

func (Line) Host

func (l Line) Host() string

func (Line) Line

func (l Line) Line() string

func (Line) LineNo

func (l Line) LineNo() uint64

func (Line) Method

func (l Line) Method() string

func (Line) Path

func (l Line) Path() string

func (Line) Query

func (l Line) Query() string

func (Line) Referrer

func (l Line) Referrer() string

func (Line) RemoteAddr

func (l Line) RemoteAddr() string

func (Line) Size

func (l Line) Size() int

func (Line) Status

func (l Line) Status() int

func (Line) Timing

func (l Line) Timing() time.Duration

func (Line) UserAgent

func (l Line) UserAgent() string

func (Line) XForwardedFor

func (l Line) XForwardedFor() string

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

func New

func New(in io.Reader, format, date, tyme, datetime string, exclude []string) (*Scanner, error)

New processes all the lines in the reader.

func NewFollow

func NewFollow(ctx context.Context, file, format, date, tyme, datetime string, exclude []string) (*Scanner, error)

NewFollow follows a file for new lines and processes them. Existing lines are not processed.

func (Scanner) DateFormats

func (s Scanner) DateFormats() (date, time, datetime string)

func (*Scanner) Line

func (s *Scanner) Line(ctx context.Context) (Line, error)

Line processes a single line.

func (Scanner) MatchExcludes

func (s Scanner) MatchExcludes(line Line) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL