vsl

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LinkTypeSession = "sess"
	LinkTypeRequest = "req"
	LinkTypeBereq   = "bereq"
)
View Source
const (
	VCLCall_RECV             = "RECV"
	VCLCall_HASH             = "HASH"
	VCLCall_PASS             = "PASS"
	VCLCall_MISS             = "MISS"
	VCLCall_HIT              = "HIT"
	VCLCall_SYNTH            = "SYNTH"
	VCLCall_DELIVER          = "DELIVER"
	VCLCall_BACKEND_RESPONSE = "BACKEND_RESPONSE"
	VCLCall_BACKEND_FETCH    = "BACKEND_FETCH"
	VCLCall_BACKEND_ERROR    = "BACKEND_ERROR"
)
View Source
const (
	TxTypeSession = "Session"
	TxTypeRequest = "Request"
	TxTypeBereq   = "BeReq"
)
View Source
const (
	SizeMB = sizeKB * 1024
)

Variables

This section is empty.

Functions

func NewTransactionParser

func NewTransactionParser(r io.Reader) *transactionParser

Types

type AcctRecord

type AcctRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

AcctRecord holds accounting information for ReqAcct and BereqAcct tags

func NewAcctRecord

func NewAcctRecord(blr BaseRecord) (AcctRecord, error)

func (AcctRecord) BodyRx

func (r AcctRecord) BodyRx() SizeValue

func (AcctRecord) BodyTx

func (r AcctRecord) BodyTx() SizeValue

func (AcctRecord) HeaderRx

func (r AcctRecord) HeaderRx() SizeValue

func (AcctRecord) HeaderTx

func (r AcctRecord) HeaderTx() SizeValue

func (AcctRecord) String

func (r AcctRecord) String() string

func (AcctRecord) TotalRx

func (r AcctRecord) TotalRx() SizeValue

func (AcctRecord) TotalTx

func (r AcctRecord) TotalTx() SizeValue

type BackendCloseRecord

type BackendCloseRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

BackendCloseRecord holds information about a backend connection close

func NewBackendCloseRecord

func NewBackendCloseRecord(blr BaseRecord) (BackendCloseRecord, error)

func (BackendCloseRecord) FileDescriptor

func (r BackendCloseRecord) FileDescriptor() int

func (BackendCloseRecord) Name

func (r BackendCloseRecord) Name() string

func (BackendCloseRecord) Reason

func (r BackendCloseRecord) Reason() string

type BackendOpenRecord

type BackendOpenRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

BackendOpenRecord holds information about a new backend connection

func NewBackendOpenRecord

func NewBackendOpenRecord(blr BaseRecord) (BackendOpenRecord, error)

func (BackendOpenRecord) FileDescriptor

func (r BackendOpenRecord) FileDescriptor() int

func (BackendOpenRecord) LocalAddr

func (r BackendOpenRecord) LocalAddr() net.IP

func (BackendOpenRecord) LocalPort

func (r BackendOpenRecord) LocalPort() int

func (BackendOpenRecord) Name

func (r BackendOpenRecord) Name() string

func (BackendOpenRecord) Reason

func (r BackendOpenRecord) Reason() string

func (BackendOpenRecord) RemoteAddr

func (r BackendOpenRecord) RemoteAddr() net.IP

func (BackendOpenRecord) RemotePort

func (r BackendOpenRecord) RemotePort() int

func (BackendOpenRecord) String added in v0.2.0

func (r BackendOpenRecord) String() string

type BackendStartRecord added in v0.2.0

type BackendStartRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

BackendStartRecord holds information about a new backend connection

func NewBackendStartRecord added in v0.2.0

func NewBackendStartRecord(blr BaseRecord) (BackendStartRecord, error)

func (BackendStartRecord) RemoteAddr added in v0.2.0

func (r BackendStartRecord) RemoteAddr() net.IP

func (BackendStartRecord) RemotePort added in v0.2.0

func (r BackendStartRecord) RemotePort() int

type BaseRecord

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

BaseRecord is a single VSL log line split by tag and value

func NewBaseRecord

func NewBaseRecord(rawLog string) (BaseRecord, error)

func (BaseRecord) RawLog

func (r BaseRecord) RawLog() string

func (BaseRecord) Tag

func (r BaseRecord) Tag() string

func (BaseRecord) Value

func (r BaseRecord) Value() string

type BeginRecord

type BeginRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

BeginRecord represents the start of a transaction log

func NewBeginRecord

func NewBeginRecord(blr BaseRecord) (BeginRecord, error)

func (BeginRecord) ESILevel

func (r BeginRecord) ESILevel() int

func (BeginRecord) ParentVXID

func (r BeginRecord) ParentVXID() VXID

func (BeginRecord) ReasonOrProtocol

func (r BeginRecord) ReasonOrProtocol() string

func (BeginRecord) Type

func (r BeginRecord) Type() string

type BereqHeaderRecord

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

BereqHeaderRecord holds headers for the vsl tag BereqHeader

func NewBereqHeaderRecord

func NewBereqHeaderRecord(blr BaseRecord) (BereqHeaderRecord, error)

func (BereqHeaderRecord) Header

func (r BereqHeaderRecord) Header() string

func (BereqHeaderRecord) HeaderValue

func (r BereqHeaderRecord) HeaderValue() string

type BereqUnsetRecord

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

BereqUnsetRecord holds a header name and value that is unset in VCL

func NewBereqUnsetRecord

func NewBereqUnsetRecord(blr BaseRecord) (BereqUnsetRecord, error)

func (BereqUnsetRecord) Header

func (r BereqUnsetRecord) Header() string

func (BereqUnsetRecord) HeaderValue

func (r BereqUnsetRecord) HeaderValue() string

type BerespHeaderRecord

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

BerespHeaderRecord holds headers for the vsl tag BerespHeader

func NewBerespHeaderRecord

func NewBerespHeaderRecord(blr BaseRecord) (BerespHeaderRecord, error)

func (BerespHeaderRecord) Header

func (r BerespHeaderRecord) Header() string

func (BerespHeaderRecord) HeaderValue

func (r BerespHeaderRecord) HeaderValue() string

type BerespUnsetRecord

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

BerespUnsetRecord holds a header name and value that is unset in VCL

func NewBerespUnsetRecord

func NewBerespUnsetRecord(blr BaseRecord) (BerespUnsetRecord, error)

func (BerespUnsetRecord) Header

func (r BerespUnsetRecord) Header() string

func (BerespUnsetRecord) HeaderValue

func (r BerespUnsetRecord) HeaderValue() string

type EndRecord

type EndRecord struct{ BaseRecord }

EndRecord marks the end of a transaction

type ErrorRecord added in v0.2.0

type ErrorRecord struct{ BaseRecord }

ErrorRecord holds error messages

type FetchBodyRecord

type FetchBodyRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

FetchBodyRecord holds information about the mode to fetch the object from the backend

func NewFetchBodyRecord

func NewFetchBodyRecord(blr BaseRecord) (FetchBodyRecord, error)

func (FetchBodyRecord) Description

func (r FetchBodyRecord) Description() string

func (FetchBodyRecord) IsStream

func (r FetchBodyRecord) IsStream() bool

func (FetchBodyRecord) Mode

func (r FetchBodyRecord) Mode() int

type FetchErrorRecord

type FetchErrorRecord struct{ BaseRecord }

FetchErrorRecord holds the error msg of an error while fetching the object from the backend

type FiltersRecord

type FiltersRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

FiltersRecord holds the list of filters applied to the body

func NewFiltersRecord

func NewFiltersRecord(blr BaseRecord) (FiltersRecord, error)

func (FiltersRecord) Filters

func (r FiltersRecord) Filters() []string

type GzipRecord added in v0.2.0

type GzipRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

GzipRecord holds G(un)zip performed on object

func NewGzipRecord added in v0.2.0

func NewGzipRecord(blr BaseRecord) (GzipRecord, error)

func (GzipRecord) Action added in v0.2.0

func (r GzipRecord) Action() string

func (GzipRecord) BitLengthOfCompressedData added in v0.2.0

func (r GzipRecord) BitLengthOfCompressedData() int64

func (GzipRecord) BitLocFirst added in v0.2.0

func (r GzipRecord) BitLocFirst() int64

func (GzipRecord) BitLocLast added in v0.2.0

func (r GzipRecord) BitLocLast() int64

func (GzipRecord) InputBytes added in v0.2.0

func (r GzipRecord) InputBytes() SizeValue

func (GzipRecord) Object added in v0.2.0

func (r GzipRecord) Object() string

func (GzipRecord) OutputBytes added in v0.2.0

func (r GzipRecord) OutputBytes() SizeValue

func (GzipRecord) String added in v0.2.0

func (r GzipRecord) String() string

func (GzipRecord) When added in v0.2.0

func (r GzipRecord) When() string

type HeaderRecord

type HeaderRecord interface {
	Header() string
	HeaderValue() string
}

HeaderRecord interface

type HitRecord

type HitRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

HitRecord contains information about a hit of an object in the cache

func NewHitRecord

func NewHitRecord(blr BaseRecord) (HitRecord, error)

func (HitRecord) Grace

func (r HitRecord) Grace() time.Duration

func (HitRecord) Keep

func (r HitRecord) Keep() time.Duration

func (HitRecord) ObjVXID

func (r HitRecord) ObjVXID() VXID

func (HitRecord) String added in v0.2.0

func (r HitRecord) String() string

func (HitRecord) TTL

func (r HitRecord) TTL() time.Duration

type LengthRecord

type LengthRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

LengthRecord represents the size of a fetch body

func NewLengthRecord

func NewLengthRecord(blr BaseRecord) (LengthRecord, error)

func (LengthRecord) Size

func (r LengthRecord) Size() SizeValue

type LinkRecord

type LinkRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

LinkRecord Links to a child transaction

func NewLinkRecord

func NewLinkRecord(blr BaseRecord) (LinkRecord, error)

func (LinkRecord) ESILevel

func (r LinkRecord) ESILevel() int

func (LinkRecord) Reason

func (r LinkRecord) Reason() string

func (LinkRecord) TXID

func (r LinkRecord) TXID() string

func (LinkRecord) Type

func (r LinkRecord) Type() string

func (LinkRecord) VXID

func (r LinkRecord) VXID() VXID

type MethodRecord

type MethodRecord struct{ BaseRecord }

MethodRecord holds the method for ReqMethod or BereqMethod tags

type ObjHeaderRecord

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

ObjHeaderRecord holds headers for the vsl tag ObjHeader

func NewObjHeaderRecord

func NewObjHeaderRecord(blr BaseRecord) (ObjHeaderRecord, error)

func (ObjHeaderRecord) Header

func (r ObjHeaderRecord) Header() string

func (ObjHeaderRecord) HeaderValue

func (r ObjHeaderRecord) HeaderValue() string

type ObjUnsetRecord

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

ObjUnsetRecord holds a header name and value that is unset in VCL

func NewObjUnsetRecord

func NewObjUnsetRecord(blr BaseRecord) (ObjUnsetRecord, error)

func (ObjUnsetRecord) Header

func (r ObjUnsetRecord) Header() string

func (ObjUnsetRecord) HeaderValue

func (r ObjUnsetRecord) HeaderValue() string

type ProtocolRecord

type ProtocolRecord struct{ BaseRecord }

ProtocolRecord holds the protocol for the ReqProtocol, RespProtocol, BereqProtocol, ... tags

type ReasonRecord

type ReasonRecord struct{ BaseRecord }

ReasonRecord is the response reason

type Record

type Record interface {
	Tag() string
	Value() string
	RawLog() string
}

Record interface for all the VSL log records

type ReqHeaderRecord

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

ReqHeaderRecord holds headers for the vsl tag ReqHeader

func NewReqHeaderRecord

func NewReqHeaderRecord(blr BaseRecord) (ReqHeaderRecord, error)

func (ReqHeaderRecord) Header

func (r ReqHeaderRecord) Header() string

func (ReqHeaderRecord) HeaderValue

func (r ReqHeaderRecord) HeaderValue() string

type ReqStartRecord

type ReqStartRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

ReqStartRecord holds information about the start of request processing

func NewReqStartRecord

func NewReqStartRecord(blr BaseRecord) (ReqStartRecord, error)

func (ReqStartRecord) ClientIP

func (r ReqStartRecord) ClientIP() net.IP

func (ReqStartRecord) ClientPort

func (r ReqStartRecord) ClientPort() int

func (ReqStartRecord) Listener

func (r ReqStartRecord) Listener() string

type ReqUnsetRecord

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

ReqUnsetRecord holds a header name and value that is unset in VCL

func NewReqUnsetRecord

func NewReqUnsetRecord(blr BaseRecord) (ReqUnsetRecord, error)

func (ReqUnsetRecord) Header

func (r ReqUnsetRecord) Header() string

func (ReqUnsetRecord) HeaderValue

func (r ReqUnsetRecord) HeaderValue() string

type RespHeaderRecord

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

RespHeaderRecord holds headers for the vsl tag RespHeader

func NewRespHeaderRecord

func NewRespHeaderRecord(blr BaseRecord) (RespHeaderRecord, error)

func (RespHeaderRecord) Header

func (r RespHeaderRecord) Header() string

func (RespHeaderRecord) HeaderValue

func (r RespHeaderRecord) HeaderValue() string

type RespUnsetRecord

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

RespUnsetRecord holds a header name and value that is unset in VCL

func NewRespUnsetRecord

func NewRespUnsetRecord(blr BaseRecord) (RespUnsetRecord, error)

func (RespUnsetRecord) Header

func (r RespUnsetRecord) Header() string

func (RespUnsetRecord) HeaderValue

func (r RespUnsetRecord) HeaderValue() string

type SessCloseRecord

type SessCloseRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

SessCloseRecord is the last record for any client connection

func NewSessCloseRecord

func NewSessCloseRecord(blr BaseRecord) (SessCloseRecord, error)

func (SessCloseRecord) Duration

func (r SessCloseRecord) Duration() time.Duration

func (SessCloseRecord) Reason

func (r SessCloseRecord) Reason() string

func (SessCloseRecord) String added in v0.2.0

func (r SessCloseRecord) String() string

type SessOpenRecord

type SessOpenRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

SessOpenRecord is the first record for a client connection with the socket-endpoints of the connection

func NewSessOpenRecord

func NewSessOpenRecord(blr BaseRecord) (SessOpenRecord, error)

func (SessOpenRecord) FileDescriptor

func (r SessOpenRecord) FileDescriptor() int

func (SessOpenRecord) LocalAddr

func (r SessOpenRecord) LocalAddr() net.IP

func (SessOpenRecord) LocalPort

func (r SessOpenRecord) LocalPort() int

func (SessOpenRecord) RemoteAddr

func (r SessOpenRecord) RemoteAddr() net.IP

func (SessOpenRecord) RemotePort

func (r SessOpenRecord) RemotePort() int

func (SessOpenRecord) SessionStart

func (r SessOpenRecord) SessionStart() time.Time

func (SessOpenRecord) SocketName

func (r SessOpenRecord) SocketName() string

func (SessOpenRecord) String added in v0.2.0

func (r SessOpenRecord) String() string

type SizeValue

type SizeValue int64

SizeValue is a custom type based on int64 to handle sizes.

func (SizeValue) String

func (s SizeValue) String() string

String returns the string representation of the size.

func (SizeValue) Value

func (s SizeValue) Value() int64

Value returns the size in bytes.

type StatusRecord

type StatusRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

StatusRecord represents an HTTP code response status

func NewStatusRecord

func NewStatusRecord(blr BaseRecord) (StatusRecord, error)

func (StatusRecord) Status

func (r StatusRecord) Status() int

type StorageRecord

type StorageRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

StorageRecord holds the type and name of the storage backend the object is stored in

func NewStorageRecord

func NewStorageRecord(blr BaseRecord) (StorageRecord, error)

func (StorageRecord) Name

func (r StorageRecord) Name() string

func (StorageRecord) Type

func (r StorageRecord) Type() string

type TTLRecord

type TTLRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

TTLRecord reprensets the ttl, grace, keep values for an object

func NewTTLRecord

func NewTTLRecord(blr BaseRecord) (TTLRecord, error)

func (TTLRecord) Age

func (r TTLRecord) Age() time.Time

func (TTLRecord) CacheStatus

func (r TTLRecord) CacheStatus() string

func (TTLRecord) Date

func (r TTLRecord) Date() time.Time

func (TTLRecord) Expires

func (r TTLRecord) Expires() time.Time

func (TTLRecord) Grace

func (r TTLRecord) Grace() time.Duration

func (TTLRecord) Keep

func (r TTLRecord) Keep() time.Duration

func (TTLRecord) MaxAge

func (r TTLRecord) MaxAge() time.Duration

func (TTLRecord) Reference

func (r TTLRecord) Reference() time.Time

func (TTLRecord) Source

func (r TTLRecord) Source() string

func (TTLRecord) String

func (r TTLRecord) String() string

func (TTLRecord) TTL

func (r TTLRecord) TTL() time.Duration

type TimestampRecord

type TimestampRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

func NewTimestampRecord

func NewTimestampRecord(blr BaseRecord) (TimestampRecord, error)

func (TimestampRecord) AbsoluteTime

func (r TimestampRecord) AbsoluteTime() time.Time

func (TimestampRecord) EventLabel

func (r TimestampRecord) EventLabel() string

func (TimestampRecord) SinceLast

func (r TimestampRecord) SinceLast() time.Duration

func (TimestampRecord) SinceStart

func (r TimestampRecord) SinceStart() time.Duration

func (TimestampRecord) String added in v0.2.0

func (r TimestampRecord) String() string

type Transaction

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

Transaction represent a singular Varnish transaction log

func NewMissingTransaction added in v0.1.3

func NewMissingTransaction(r LinkRecord) *Transaction

NewMissingTransaction initializes a transaction that is missing in the VSL logs from a Link tag record

func NewTransaction

func NewTransaction(line string) (*Transaction, error)

NewTransaction initializes a new transaction by parsing the first line of the log

func (*Transaction) Children

func (t *Transaction) Children() map[string]*Transaction

func (*Transaction) ChildrenSortedByVXID

func (t *Transaction) ChildrenSortedByVXID() []*Transaction

ChildrenSortedByVXID returns a slice with all the children sorted by VXID

func (*Transaction) ESILevel

func (t *Transaction) ESILevel() int

func (*Transaction) FirstRecordOfTag

func (t *Transaction) FirstRecordOfTag(tag string) Record

FirstRecordOfTag returns the first record for the given tag

func (*Transaction) FirstRecordOfType

func (t *Transaction) FirstRecordOfType(target interface{}) Record

FirstRecordOfType returns the first record for the given type

func (*Transaction) FullRawLog added in v0.1.7

func (t *Transaction) FullRawLog(withChildren bool) string

FullRawLog returns the complete VSL log from this transaction if withChildren is true it also includes the log from all its children recursively

func (*Transaction) LastRecordOfTag

func (t *Transaction) LastRecordOfTag(tag string) Record

LastRecordOfTag returns the last record for the given tag

func (*Transaction) LastRecordOfType

func (t *Transaction) LastRecordOfType(target interface{}) Record

LastRecordOfType returns the last record for the given type

func (*Transaction) Level

func (t *Transaction) Level() int

func (*Transaction) LogRecords

func (t *Transaction) LogRecords() []Record

func (*Transaction) Parent

func (t *Transaction) Parent() *Transaction

func (*Transaction) RawLog

func (t *Transaction) RawLog() string

func (*Transaction) RootParent

func (t *Transaction) RootParent() *Transaction

RootParent returns the root transaction which has no parent

func (*Transaction) TXID

func (t *Transaction) TXID() string

func (*Transaction) Type

func (t *Transaction) Type() string

func (*Transaction) VXID

func (t *Transaction) VXID() VXID

type TransactionSet

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

TransactionSet groups multiple Varnish transaction logs together

func (TransactionSet) GroupRelatedTransactions

func (t TransactionSet) GroupRelatedTransactions() [][]*Transaction

func (TransactionSet) RawLog

func (t TransactionSet) RawLog() string

RawLog returns the complete VSL raw log from all the transactions

func (TransactionSet) Transactions

func (t TransactionSet) Transactions() []*Transaction

func (TransactionSet) TransactionsMap

func (t TransactionSet) TransactionsMap() map[string]*Transaction

func (TransactionSet) UniqueRootParents

func (t TransactionSet) UniqueRootParents() []*Transaction

UniqueRootParents iterates over an array of transactions and returns an array with only the parent transactions.

type URLRecord

type URLRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

URLRecord holds request URL from ReqURL and BereqURL tags

func NewURLRecord

func NewURLRecord(blr BaseRecord) (URLRecord, error)

func (URLRecord) Path

func (r URLRecord) Path() string

func (URLRecord) Query

func (r URLRecord) Query() string

func (URLRecord) URL

func (r URLRecord) URL() url.URL

type VCLCallRecord

type VCLCallRecord struct{ BaseRecord }

VCLCallRecord is the VCL method called (RECV, DELIVER, BACKEND_FETCH, ...)

type VCLLogRecord

type VCLLogRecord struct {
	BaseRecord
	// contains filtered or unexported fields
}

VCLLogRecord holds vsl tag VCL_Log key is empty if the log value is not formatted as 'key: value'

func NewVCLLogRecord

func NewVCLLogRecord(blr BaseRecord) (VCLLogRecord, error)

func (VCLLogRecord) Key

func (r VCLLogRecord) Key() string

func (VCLLogRecord) Value

func (r VCLLogRecord) Value() string

type VCLReturnRecord

type VCLReturnRecord struct{ BaseRecord }

VCLReturnRecord is the VCL method return value (hash, lookup, fetch, deliver, ...)

type VCLUseRecord

type VCLUseRecord struct{ BaseRecord }

VCLUseRecord is the VCL name in use

type VXID

type VXID uint32

In Varnish the vxid is "uint32_t"

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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