Documentation ¶
Overview ¶
Package p4dlog parses Perforce Hexlix Core Server text logs (not structured logs).
These are logs created by p4d, as documented by:
https://community.perforce.com/s/article/2525
It assumes you have set configurable server=3 (or greater) You may also have decided to set track=1 to get more detailed usage of access to different tables.
See p4dlog_test.go for examples of log entries.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block is a block of lines parsed from a file
type Command ¶
type Command struct { ProcessKey string `json:"processKey"` Cmd []byte `json:"cmd"` Pid int64 `json:"pid"` LineNo int64 `json:"lineNo"` User []byte `json:"user"` Workspace []byte `json:"workspace"` StartTime time.Time `json:"startTime"` EndTime time.Time `json:"endTime"` ComputeLapse float32 `json:"computeLapse"` CompletedLapse float32 `json:"completedLapse"` IP []byte `json:"ip"` App []byte `json:"app"` Args []byte `json:"args"` Running int64 `json:"running"` UCpu int64 `json:"uCpu"` SCpu int64 `json:"sCpu"` DiskIn int64 `json:"diskIn"` DiskOut int64 `json:"diskOut"` IpcIn int64 `json:"ipcIn"` IpcOut int64 `json:"ipcOut"` MaxRss int64 `json:"maxRss"` PageFaults int64 `json:"pageFaults"` RpcMsgsIn int64 `json:"rpcMsgsIn"` RpcMsgsOut int64 `json:"rpcMsgsOut"` RpcSizeIn int64 `json:"rpcSizeIn"` RpcSizeOut int64 `json:"rpcSizeOut"` RpcHimarkFwd int64 `json:"rpcHimarkFwd"` RpcHimarkRev int64 `json:"rpcHimarkRev"` RpcSnd float32 `json:"rpcSnd"` RpcRcv float32 `json:"rpcRcv"` CmdError bool `json:"cmderror"` Tables map[string]*Table // contains filtered or unexported fields }
Command is a command found in the block
func (*Command) MarshalJSON ¶
MarshalJSON - handle time formatting
type P4dFileParser ¶
type P4dFileParser struct {
// contains filtered or unexported fields
}
P4dFileParser - manages state
func NewP4dFileParser ¶
func NewP4dFileParser(logger *logrus.Logger) *P4dFileParser
NewP4dFileParser - create and initialise properly
func (*P4dFileParser) CmdsPendingCount ¶ added in v0.0.3
func (fp *P4dFileParser) CmdsPendingCount() int
CmdsPendingCount - count of unmatched commands
func (*P4dFileParser) LogParser ¶
func (fp *P4dFileParser) LogParser(ctx context.Context, lines chan []byte, cmdchan chan Command)
LogParser - interface to be run on a go routine - commands are returned on cmdchan
func (*P4dFileParser) SetDebugMode ¶ added in v0.1.0
func (fp *P4dFileParser) SetDebugMode()
SetDebugMode - turn on debugging - very verbose!
func (*P4dFileParser) SetDurations ¶ added in v0.1.0
func (fp *P4dFileParser) SetDurations(outputDuration, debugDuration time.Duration)
SetDurations - for debugging
type P4dParseOptions ¶
type P4dParseOptions struct { File string // contains filtered or unexported fields }
P4dParseOptions - Options for parsing - mainly for command line usage
type Table ¶ added in v0.0.2
type Table struct { TableName string `json:"tableName"` PagesIn int64 `json:"pagesIn"` PagesOut int64 `json:"pagesOut"` PagesCached int64 `json:"pagesCached"` PagesSplitInternal int64 `json:"pagesSplitInternal"` PagesSplitLeaf int64 `json:"pagesSplitLeaf"` ReadLocks int64 `json:"readLocks"` WriteLocks int64 `json:"writeLocks"` GetRows int64 `json:"getRows"` PosRows int64 `json:"posRows"` ScanRows int64 `json:"scanRows"` PutRows int64 `json:"putRows"` DelRows int64 `json:"delRows"` TotalReadWait int64 `json:"totalReadWait"` TotalReadHeld int64 `json:"totalReadHeld"` TotalWriteWait int64 `json:"totalWriteWait"` TotalWriteHeld int64 `json:"totalWriteHeld"` MaxReadWait int64 `json:"maxReadWait"` MaxReadHeld int64 `json:"maxReadHeld"` MaxWriteWait int64 `json:"maxWriteWait"` MaxWriteHeld int64 `json:"maxWriteHeld"` PeekCount int64 `json:"peekCount"` TotalPeekWait int64 `json:"totalPeekWait"` TotalPeekHeld int64 `json:"totalPeekHeld"` MaxPeekWait int64 `json:"maxPeekWait"` MaxPeekHeld int64 `json:"maxPeekHeld"` TriggerLapse float32 `json:"triggerLapse"` }
Table stores track information per table (part of Command)