vsl

package
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package vsl, reference: https://varnish-cache.org/docs/trunk/reference/vsl.html

Index

Constants

View Source
const (
	LinkTypeSession = "sess"
	LinkTypeRequest = "req"
	LinkTypeBereq   = "bereq"
)
View Source
const (
	VCLCallRECV            = "RECV"
	VCLCallHASH            = "HASH"
	VCLCallPASS            = "PASS"
	VCLCallMISS            = "MISS"
	VCLCallHIT             = "HIT"
	VCLCallSYNTH           = "SYNTH"
	VCLCallDELIVER         = "DELIVER"
	VCLCallBACKENDRESPONSE = "BACKEND_RESPONSE"
	VCLCallBACKENDFETCH    = "BACKEND_FETCH"
	VCLCallBACKENDERROR    = "BACKEND_ERROR"
)
View Source
const (
	SizeMB = sizeKB * 1024
)

Variables

View Source
var (
	HdrNameHost = CanonicalHeaderName("Host")
)

Special headers

Functions

func CanonicalHeaderName added in v0.3.1

func CanonicalHeaderName(name string) string

CanonicalHeaderName returns the canonical format of the header name. The canonicalization converts the first letter and any letter following a hyphen to upper case; the rest are converted to lowercase. For example, the canonical key for "accept-encoding" is "Accept-Encoding".

func NewTransactionParser

func NewTransactionParser(r io.Reader) *transactionParser

Types

type AcctRecord

type AcctRecord struct {
	BaseRecord
	HeaderTx SizeValue // Header bytes transmitted
	BodyTx   SizeValue // Body bytes transmitted
	TotalTx  SizeValue // Total bytes transmitted
	HeaderRx SizeValue // Header bytes received
	BodyRx   SizeValue // Body bytes received
	TotalRx  SizeValue // Total bytes received
}

AcctRecord holds accounting information for ReqAcct and BereqAcct tags

func NewAcctRecord

func NewAcctRecord(blr BaseRecord) (AcctRecord, error)

func (AcctRecord) String

func (r AcctRecord) String() string

type BackendCloseRecord

type BackendCloseRecord struct {
	BaseRecord
	FileDescriptor int    // Connection file descriptor
	Name           string // Backend display name
	Reason         string // "close" or "recycle"
	OptionalReason string // Optional reason
}

BackendCloseRecord holds information about a backend connection close

func NewBackendCloseRecord

func NewBackendCloseRecord(blr BaseRecord) (BackendCloseRecord, error)

type BackendOpenRecord

type BackendOpenRecord struct {
	BaseRecord
	FileDescriptor int    // Connection file descriptor
	Name           string // Backend display name
	RemoteAddr     net.IP // Remote addr connecting
	RemotePort     int    // Remote port
	LocalAddr      net.IP // Local addr
	LocalPort      int    // Local port
	Reason         string // connect or reuse
}

BackendOpenRecord holds information about a new backend connection

func NewBackendOpenRecord

func NewBackendOpenRecord(blr BaseRecord) (BackendOpenRecord, error)

func (BackendOpenRecord) ConnStr added in v0.5.7

func (r BackendOpenRecord) ConnStr() string

func (BackendOpenRecord) String added in v0.2.0

func (r BackendOpenRecord) String() string

type BackendReuseRecord added in v0.4.12

type BackendReuseRecord struct {
	BaseRecord
	FileDescriptor int    // Connection file descriptor
	Name           string // Backend display name
}

BackendReuseRecord holds information about a backend reuse (keep-alive)

Note that this record was deprecated in favor of BackendClose

func NewBackendReuseRecord added in v0.4.12

func NewBackendReuseRecord(blr BaseRecord) (BackendReuseRecord, error)

type BackendStartRecord added in v0.2.0

type BackendStartRecord struct {
	BaseRecord
	RemoteAddr net.IP // Remote address
	RemotePort int    // Remote port
}

BackendStartRecord holds information about a new backend connection

func NewBackendStartRecord added in v0.2.0

func NewBackendStartRecord(blr BaseRecord) (BackendStartRecord, error)

func (BackendStartRecord) ConnStr added in v0.5.7

func (r BackendStartRecord) ConnStr() string

func (BackendStartRecord) String added in v0.5.7

func (r BackendStartRecord) String() string

type BaseRecord

type BaseRecord struct {
	Tag      string // VSL Tag (Begin, Timestamp, ReqURL, ReqHeader, ...)
	RawValue string // Value after the tag
	// 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) GetRawLog added in v0.4.0

func (r BaseRecord) GetRawLog() string

func (BaseRecord) GetRawValue added in v0.4.0

func (r BaseRecord) GetRawValue() string

func (BaseRecord) GetTag added in v0.4.0

func (r BaseRecord) GetTag() string

func (BaseRecord) String added in v0.4.0

func (r BaseRecord) String() string

type BeginRecord

type BeginRecord struct {
	BaseRecord
	RecordType string // sess, req, bereq, ...
	Parent     VXID   // parent ID
	ESILevel   int    // ESI level, 0 if not an ESI
	Reason     string // reason of the transaction
}

BeginRecord represents the start of a transaction log

func NewBeginRecord

func NewBeginRecord(blr BaseRecord) (BeginRecord, error)

type BrotliRecord added in v0.5.7

type BrotliRecord struct {
	BaseRecord
	Operation   rune      // 'B': Brotli, 'U': Unbrotli, 'u': Unbrotli-test
	Direction   rune      // 'F': Fetch, 'D': Deliver
	BytesInput  SizeValue // Bytes input
	BytesOutput SizeValue // Bytes output
}

BrotliRecord holds Brotli compression/decompression operation data

func NewBrotliRecord added in v0.5.7

func NewBrotliRecord(blr BaseRecord) (BrotliRecord, error)

func (BrotliRecord) String added in v0.5.7

func (r BrotliRecord) String() 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
	Mode        int    // Body fetch mode
	Description string // Description of body fetch mode
	Stream      bool   // Whether it is a stream fetch
}

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

func NewFetchBodyRecord

func NewFetchBodyRecord(blr BaseRecord) (FetchBodyRecord, error)

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
	Filters []string // List of filters applied to the body
}

FiltersRecord holds the list of filters applied to the body

func NewFiltersRecord

func NewFiltersRecord(blr BaseRecord) (FiltersRecord, error)

type GzipRecord added in v0.2.0

type GzipRecord struct {
	BaseRecord
	Action                    string    // G: Gzip, U: Gunzip, u: Gunzip-test
	When                      string    // F: Fetch, D: Deliver
	Object                    string    // E: ESI, -: Plain object
	InputBytes                SizeValue // Bytes input
	OutputBytes               SizeValue // Bytes output
	BitLocFirst               int64     // Bit location of first deflate block
	BitLocLast                int64     // Bit location of 'last' bit
	BitLengthOfCompressedData int64     // Bit length of compressed data
}

GzipRecord holds G(un)zip performed on object

func NewGzipRecord added in v0.2.0

func NewGzipRecord(blr BaseRecord) (GzipRecord, error)

func (GzipRecord) String added in v0.2.0

func (r GzipRecord) String() string

type HdrState added in v0.3.1

type HdrState int

HdrState represents the state of an HTTP header within the Varnish lifecycle. It indicates whether a header was originally received, added, modified, or deleted.

const (
	HdrStateReceived HdrState = iota // Header as sent by the client
	HdrStateAdded                    // Header added within VCL
	HdrStateModified                 // Header modified within VCL
	HdrStateDeleted                  // Header deleted within VCL
)

func (HdrState) String added in v0.3.1

func (s HdrState) String() string

String returns a human-readable representation of the HdrState.

type HdrValue added in v0.3.1

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

HdrValue represents a single header value and its state

func (HdrValue) MarshalJSON added in v0.4.0

func (h HdrValue) MarshalJSON() ([]byte, error)

func (HdrValue) State added in v0.3.1

func (h HdrValue) State() HdrState

State returns the header state

func (HdrValue) String added in v0.4.5

func (h HdrValue) String() string

func (HdrValue) Value added in v0.3.1

func (h HdrValue) Value() string

Value returns the header value

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

Header represents an HTTP header within the VSL

func (Header) ID added in v0.3.1

func (h Header) ID() int

func (Header) MarshalJSON added in v0.4.0

func (h Header) MarshalJSON() ([]byte, error)

func (Header) Name added in v0.3.1

func (h Header) Name() string

func (Header) Values added in v0.3.1

func (h Header) Values(received bool) []HdrValue

Values returns all the values When received is true, it returns the receivedValues

type HeaderRecord

type HeaderRecord struct {
	BaseRecord
	Name       string // Name of the header
	Value      string // Value of the header
	HeaderType string // Type (ReqHeader, BereqHeader, ...)
}

HeaderRecord represents an HTTP header log record

func NewHeaderRecord added in v0.3.1

func NewHeaderRecord(blr BaseRecord) (HeaderRecord, error)

IsRespHeader returns true if its a response header

func (HeaderRecord) IsRespHeader added in v0.3.1

func (r HeaderRecord) IsRespHeader() bool

type HeaderUnsetRecord added in v0.3.1

type HeaderUnsetRecord struct {
	BaseRecord
	Name       string // Name of the header
	Value      string // Value of the header
	HeaderType string // Type (ReqUnset, BereqUnset, ...)
}

HeaderUnsetRecord represents an HTTP header log record which is being unset

func NewHeaderUnsetRecord added in v0.3.1

func NewHeaderUnsetRecord(blr BaseRecord) (HeaderUnsetRecord, error)

func (HeaderUnsetRecord) IsRespHeader added in v0.3.1

func (r HeaderUnsetRecord) IsRespHeader() bool

IsRespHeader returns true if its a response header

type Headers added in v0.3.1

type Headers map[string]Header

Headers represents a set of HTTP headers within the VSL

func (Headers) Add added in v0.3.1

func (h Headers) Add(name string, value string, state HdrState)

Add adds a header value to the Headers map. If the header already exists, the value is appended. Otherwise, a new Header is created.

If the state is 'modified', previous values are discarded as Varnish VCL removes all the previous values on 'set' and 'unset'.

func (*Headers) Clear added in v0.3.1

func (h *Headers) Clear()

Clear removes all entries from the Headers map.

func (Headers) Delete added in v0.3.1

func (h Headers) Delete(name string)

Delete sets the state of all values of the given header as deleted.

func (Headers) Get added in v0.3.1

func (h Headers) Get(name string, received bool) string

Get gets the first value associated with the given header name.

When received is true it only returns values from the receivedValues slice. If there are no values it returns an empty string.

func (Headers) GetSortedHeaders added in v0.3.1

func (h Headers) GetSortedHeaders() []Header

func (Headers) Values added in v0.3.1

func (h Headers) Values(name string, received bool) []HdrValue

Values returns all the values associated with the given header name.

When received is true, it returns the values from the receivedValues slice.

type HitRecord

type HitRecord struct {
	BaseRecord
	ObjVXID       VXID          // object VXID
	TTL           time.Duration // remaining TTL
	Grace         time.Duration // grace period
	Keep          time.Duration // keep period
	Fetched       SizeValue     // bytes fetched so far
	ContentLength SizeValue     // Content length
}

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

It can be either a Hit, HitMiss or HitPass record

func NewHitRecord

func NewHitRecord(blr BaseRecord) (HitRecord, error)

func (HitRecord) String added in v0.2.0

func (r HitRecord) String() string

type LengthRecord

type LengthRecord struct {
	BaseRecord
	Size SizeValue // Size of the fetch body
}

LengthRecord represents the size of a fetch body

func NewLengthRecord

func NewLengthRecord(blr BaseRecord) (LengthRecord, error)

type LinkRecord

type LinkRecord struct {
	BaseRecord
	TXID     TXID   // Custom transaction ID
	VXID     VXID   // Child vxid
	TXType   string // Child type ("sess", "req" or "bereq")
	Reason   string // Reason
	ESILevel int    // Child task sub-level
}

LinkRecord Links to a child transaction

func NewLinkRecord

func NewLinkRecord(blr BaseRecord) (LinkRecord, error)

type MSE4ChunkFaultRecord added in v0.5.7

type MSE4ChunkFaultRecord struct {
	BaseRecord
	ChunksProcessed      int64         // Number of chunks processed
	BytesProcessed       SizeValue     // Number of bytes processed
	TimeProcessing       time.Duration // Total time spent on processing (seconds)
	TimeMemoryAllocation time.Duration // Time spent allocating memory (seconds)
	TimeDiskIOWait       time.Duration // Time spent waiting for disk IO (seconds)
}

MSE4ChunkFaultRecord holds MSE4 persisted chunk memory fault timing data

func NewMSE4ChunkFaultRecord added in v0.5.7

func NewMSE4ChunkFaultRecord(blr BaseRecord) (MSE4ChunkFaultRecord, error)

func (MSE4ChunkFaultRecord) String added in v0.5.7

func (r MSE4ChunkFaultRecord) String() string

type MSE4NewObjectRecord added in v0.5.5

type MSE4NewObjectRecord struct {
	BaseRecord
	AllocationChunks     int64         // Number of allocation chunks created
	BytesProcessed       SizeValue     // Number of bytes processed
	TimeElapsed          time.Duration // Time elapsed between object creation and finalization (seconds)
	TimeMSE4Processing   time.Duration // Total time spent on MSE4 processing (seconds)
	TimeMemoryAllocation time.Duration // Time spent allocating memory (seconds)
	TimeResourceWait     time.Duration // Time spent waiting for resource acquisition (seconds) [persisted only]
	TimeDiskIOFetch      time.Duration // Time spent waiting for disk IO during fetch (seconds) [persisted only]
	TimeDiskIOFinalize   time.Duration // Time spent waiting for disk IO during finalization (seconds) [persisted only]
	IsPersisted          bool          // Whether this object was persisted to disk
}

MSE4NewObjectRecord holds MSE4 new object timing data

func NewMSE4NewObjectRecord added in v0.5.5

func NewMSE4NewObjectRecord(blr BaseRecord) (MSE4NewObjectRecord, error)

func (MSE4NewObjectRecord) String added in v0.5.5

func (r MSE4NewObjectRecord) String() string

type MSE4ObjIterRecord added in v0.5.7

type MSE4ObjIterRecord struct {
	BaseRecord
	TimeElapsed          time.Duration // Time elapsed between start and end of iteration (seconds)
	BytesProcessed       SizeValue     // Number of bytes processed
	TimeProcessing       time.Duration // Total time spent processing (seconds)
	TimeBackendWait      time.Duration // Time spent waiting for backend data (seconds)
	DiskIOBytes          SizeValue     // Disk IO bytes processed [persisted only]
	TimeDiskIOProcessing time.Duration // Time spent on processing disk IO (seconds) [persisted only]
	IsPersisted          bool          // Whether this object was persisted to disk
}

MSE4ObjIterRecord holds MSE4 object payload iteration timing data

func NewMSE4ObjIterRecord added in v0.5.7

func NewMSE4ObjIterRecord(blr BaseRecord) (MSE4ObjIterRecord, error)

func (MSE4ObjIterRecord) String added in v0.5.7

func (r MSE4ObjIterRecord) String() string

type MethodRecord

type MethodRecord struct{ BaseRecord }

MethodRecord holds the method for ReqMethod or BereqMethod tags

type PipeAcctRecord added in v0.4.5

type PipeAcctRecord struct {
	BaseRecord
	ClientReqHeaders  SizeValue // Client request headers
	BackendReqHeaders SizeValue // Backend request headers
	PipedFrom         SizeValue // Piped bytes from client
	PipedTo           SizeValue // Piped bytes to client
}

PipeAcctRecord holds accounting information for PipeAcct tags

func NewPipeAcctRecord added in v0.4.5

func NewPipeAcctRecord(blr BaseRecord) (PipeAcctRecord, error)

func (PipeAcctRecord) String added in v0.4.5

func (r PipeAcctRecord) String() 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 {
	String() string
	GetTag() string
	GetRawValue() string
	GetRawLog() string
}

Record interface for all the VSL log records

type ReqStartRecord

type ReqStartRecord struct {
	BaseRecord
	ClientIP   net.IP // Client IP4/6 address (0.0.0.0 for UDS)
	ClientPort int    // Client Port number (0 for Unix domain sockets)
	Listener   string // Listener name (from -a)
}

ReqStartRecord holds information about the start of request processing

func NewReqStartRecord

func NewReqStartRecord(blr BaseRecord) (ReqStartRecord, error)

func (ReqStartRecord) ConnStr added in v0.5.7

func (r ReqStartRecord) ConnStr() string

func (ReqStartRecord) String added in v0.5.7

func (r ReqStartRecord) String() string

type SessCloseRecord

type SessCloseRecord struct {
	BaseRecord
	Reason   string        // Why the connection closed
	Duration time.Duration // How long the session was open
}

SessCloseRecord is the last record for any client connection

func NewSessCloseRecord

func NewSessCloseRecord(blr BaseRecord) (SessCloseRecord, error)

func (SessCloseRecord) String added in v0.2.0

func (r SessCloseRecord) String() string

type SessOpenRecord

type SessOpenRecord struct {
	BaseRecord
	RemoteAddr     net.IP    // Remote IPv4/6 address / 0.0.0.0 for UDS
	RemotePort     int       // Remote TCP port / 0 for UDS
	SocketName     string    // Socket name (from -a argument)
	LocalAddr      net.IP    // Local IPv4/6 address / 0.0.0.0 for UDS
	LocalPort      int       // Local TCP port / 0 for UDS
	SessionStart   time.Time // Session start time (unix epoch)
	FileDescriptor int       // File descriptor number
}

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) ConnStr added in v0.5.7

func (r SessOpenRecord) ConnStr() 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
	Status int // HTTP Status code
}

StatusRecord represents an HTTP code response status

func NewStatusRecord

func NewStatusRecord(blr BaseRecord) (StatusRecord, error)

type StorageRecord

type StorageRecord struct {
	BaseRecord
	StorageType string // Type ("malloc", "file", "persistent" etc.)
	Name        string // Name of storage backend
}

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

func NewStorageRecord

func NewStorageRecord(blr BaseRecord) (StorageRecord, error)

type TTLRecord

type TTLRecord struct {
	BaseRecord
	Source      string        // "RFC", "VCL" or "HFP"
	TTL         time.Duration // Time-to-live
	Grace       time.Duration // Grace period
	Keep        time.Duration // Keep period
	Reference   time.Time     // Reference time for TTL
	Age         time.Time     // Age (incl Age: header value)
	Date        time.Time     // Date header
	Expires     time.Time     // Expires header
	MaxAge      time.Duration // Max-Age from Cache-Control header
	CacheStatus string        // "cacheable" or "uncacheable"
}

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

func NewTTLRecord

func NewTTLRecord(blr BaseRecord) (TTLRecord, error)

func (TTLRecord) String

func (r TTLRecord) String() string

type TXID added in v0.4.0

type TXID string

TXID is an unique identifier for a transaction

type TimestampRecord

type TimestampRecord struct {
	BaseRecord
	EventLabel   string        // Start, Req, Fetch, Process, Resp, ...
	StartTime    time.Time     // Start time of the timestamp (absoluteTime - sinceLast)
	AbsoluteTime time.Time     // Absolute time of the timestamp (end time, when the record was logged)
	SinceStart   time.Duration // Duration since the start of the tx
	SinceLast    time.Duration // Duration since the last timestamp
}

func NewTimestampRecord

func NewTimestampRecord(blr BaseRecord) (TimestampRecord, error)

func (TimestampRecord) String added in v0.2.0

func (r TimestampRecord) String() string

String returns the timestamp in a human readable string

type Transaction

type Transaction struct {
	TXID        TXID     // Custom transaction id: {vxid}-{type}-{reason}[-{ESILevel}] - eg: 33030-req-esi-1
	VXID        VXID     // Transaction ID
	Level       int      // Transaction level
	Reason      string   // Reason from the begin tag (rxreq, esi, fetch, ...)
	ESILevel    int      // ESI level, 0 if not an ESI request
	TXType      TxType   // Session, Request, BeReq
	RawLog      string   // Raw log string
	Records     []Record // VSL log records
	ReqHeaders  Headers  // Request Headers
	RespHeaders Headers  // Response Headers
	Parent      VXID     // Parent ID
	Children    []VXID   // Transaction VXIDs which are children of this transaction
}

Transaction represent a singular Varnish transaction log

func NewMissingTransaction added in v0.1.3

func NewMissingTransaction(r LinkRecord) *Transaction

NewMissingTransaction initializes a dummy transaction that is missing from the VSL logs using 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) Duration added in v0.4.0

func (t *Transaction) Duration() time.Duration

Duration returns the approximate duration of the transaction

func (*Transaction) EndTime added in v0.4.0

func (t *Transaction) EndTime() time.Time

EndTime is a helper function that returns the approximate end time of the transaction since varnishlog does not record the exact end time of a transaction the last timestamp or sessclose record is used instead

func (*Transaction) GetBackendConnStr added in v0.4.0

func (t *Transaction) GetBackendConnStr() string

GetBackendConnStr is a helper function to obtain the backend in the format <HOST>:<PORT> returns an empty string if not found

func (*Transaction) LastRecordByTag added in v0.4.4

func (t *Transaction) LastRecordByTag(tag string, index int) Record

LastRecordByTag finds the last record with the given tag, searching backwards starting from the given index (inclusive). Returns nil if no matching record is found.

func (*Transaction) NextRecordByTag added in v0.4.4

func (t *Transaction) NextRecordByTag(tag string, index int) Record

NextRecordByTag finds the next record with the given tag, searching forwards starting from the given index (exclusive). Returns nil if no matching record is found.

func (*Transaction) RecordByTag added in v0.3.1

func (t *Transaction) RecordByTag(tag string, first bool) Record

RecordByTag returns the the first or last record with the given tag. If first is true, it returns the first occurrence; otherwise, it returns the last. It returns nil if no record matches the tag.

func (*Transaction) RecordValueByTag added in v0.3.1

func (t *Transaction) RecordValueByTag(tag string, first bool) string

RecordValueByTag returns the value of the first or last record with the given tag. If first is true, it returns the first occurrence; otherwise, it returns the last. It returns an empty string if no record matches the tag.

func (*Transaction) StartTime added in v0.4.0

func (t *Transaction) StartTime() time.Time

StartTime is a helper function that returns the approximate start time of the transaction since varnishlog does not record the exact start time of a transaction the first timestamp or sessopen record is used instead

type TransactionSet

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

TransactionSet groups multiple Varnish transaction logs together

func (TransactionSet) GetChildTX added in v0.4.0

func (t TransactionSet) GetChildTX(parent, child VXID) *Transaction

GetChildTX returns the transaction child by VXID or nil if not found

func (TransactionSet) GetTX added in v0.4.0

func (t TransactionSet) GetTX(vxid VXID) *Transaction

GetTX returns the transaction by VXID or nil if not found

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) RawLogForTx added in v0.4.0

func (t TransactionSet) RawLogForTx(tx *Transaction, includeChildrenTxs bool) string

RawLogForTx returns the VSL raw log for this transactions and optionally its children

func (TransactionSet) RootParent added in v0.4.0

func (t TransactionSet) RootParent(tx *Transaction, includeSession bool) *Transaction

RootParent returns the root transaction which has no parent If includeSession is false transactions of type session are excluded

func (TransactionSet) SortedChildren added in v0.4.0

func (t TransactionSet) SortedChildren(tx *Transaction) []*Transaction

SortedChildren returns a sorted slice of all the tx children

func (TransactionSet) Transactions

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

Transactions returns a sorted slice with all the transactions

func (TransactionSet) TransactionsMap

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

TransactionsMap returns the transactions map

func (TransactionSet) UniqueRootParents

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

UniqueRootParents iterates over an array of transactions and returns an array with only the parent transactions. If includeSession is false transactions of type session are excluded

type TxType added in v0.3.1

type TxType string

TxType represents the type of a Varnish transaction.

const (
	TxTypeSession TxType = "Session"
	TxTypeRequest TxType = "Request"
	TxTypeBereq   TxType = "BeReq"
)

type URLRecord

type URLRecord struct {
	BaseRecord
	URL url.URL // Request URL
}

URLRecord holds request URL from ReqURL and BereqURL tags

func NewURLRecord

func NewURLRecord(blr BaseRecord) (URLRecord, error)

func (URLRecord) MarshalJSON added in v0.4.0

func (u URLRecord) MarshalJSON() ([]byte, error)

func (URLRecord) Path

func (r URLRecord) Path() string

func (URLRecord) QueryString added in v0.4.0

func (r URLRecord) QueryString() string

type VCLCallRecord

type VCLCallRecord struct{ BaseRecord }

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

type VCLLogRecord

type VCLLogRecord struct {
	BaseRecord
	Key   string // Only if the format of the log is 'Key: value'
	Value string
}

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) String added in v0.2.7

func (r VCLLogRecord) String() 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

VXID in Varnish the vxid is of type "uint32_t"

Directories

Path Synopsis
Package tags contains all the known VSL tags
Package tags contains all the known VSL tags

Jump to

Keyboard shortcuts

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