Documentation ¶
Overview ¶
Package analysis implements heuristical frequency analysis of Psiphon Tunnel Core server logs. Log lines are parsed into 3 distinct log types: message, metrics and unknown. Under these log types the number of logs of each unique identifier is counted. The unique identifiers are as follows: message: "msg" field metrics: "event_name" field unknown: key graph
Index ¶
- type BaseLogModel
- type LogFields
- type LogLevel
- type LogModel
- type LogModelStats
- type LogModelStatsMetrics
- type LogStats
- func (l *LogStats) NumDistinctLogs() uint
- func (l *LogStats) ParseFile(filename string) error
- func (l *LogStats) ParseLogLine(log string) error
- func (l *LogStats) Print(messages, metrics, unknown, printStructure, printExample bool)
- func (l *LogStats) SortLogModels(messages, metrics, unknown bool) (models []interface{}, numLogs uint)
- type LogTypeStats
- type MessageLogContext
- type MessageLogError
- type MessageLogKey
- type MessageLogModel
- type MessageLogModelStats
- type MessageLogName
- type MessageLogStats
- type MetricsLogEventName
- type MetricsLogModel
- type MetricsLogModelStats
- type MetricsLogStats
- type UnknownLogModel
- type UnknownLogModelStats
- type UnknownLogStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseLogModel ¶
type BaseLogModel struct { Example string Node node }
func (*BaseLogModel) JsonString ¶
func (a *BaseLogModel) JsonString() string
func (*BaseLogModel) Print ¶
func (a *BaseLogModel) Print(printStructure, printExample bool)
type LogModelStats ¶
type LogModelStats struct {
Count uint
}
type LogModelStatsMetrics ¶
type LogModelStatsMetrics interface {
NumLogs() uint
}
type LogStats ¶
type LogStats struct { MessageLogModels MessageLogStats MetricsLogModels MetricsLogStats UnknownLogModels UnknownLogStats }
func NewLogStats ¶
func NewLogStats() (l *LogStats)
NewLogStats initializes a new LogStats structure.
func NewLogStatsFromFiles ¶
func (*LogStats) NumDistinctLogs ¶
NumDistinctLogs returns the number of unique log models contained within the LogStats structure.
func (*LogStats) ParseFile ¶
ParseFile takes a psiphond log file as input, parses the log lines into log models and updates the LogStats structure.
func (*LogStats) ParseLogLine ¶
ParseLogLine attempts to parse a log line into a log model and then updates the LogStats structure.
func (*LogStats) SortLogModels ¶
func (l *LogStats) SortLogModels(messages, metrics, unknown bool) (models []interface{}, numLogs uint)
sortLogModelsDescending merges all log models of different types and then sorts them in ascending order by the number times each occurs. Returns the sorted list and the total number of logs represented by each log model in the list.
type LogTypeStats ¶
type LogTypeStats struct {
Count uint
}
type MessageLogContext ¶
type MessageLogContext string
type MessageLogError ¶
type MessageLogError string
type MessageLogKey ¶
type MessageLogKey string
type MessageLogModel ¶
type MessageLogModel struct { BaseLogModel Msg MessageLogName Level LogLevel MessageLogContext *MessageLogContext MessageLogError *MessageLogError }
func (*MessageLogModel) Print ¶
func (a *MessageLogModel) Print(printStructure, printExample bool)
type MessageLogModelStats ¶
type MessageLogModelStats struct { LogModelStats MessageLogModel }
func (MessageLogModelStats) NumLogs ¶
func (a MessageLogModelStats) NumLogs() uint
func (*MessageLogModelStats) Print ¶
func (a *MessageLogModelStats) Print(printStructure, printExample bool)
func (*MessageLogModelStats) PrintWithRelativePercent ¶
func (a *MessageLogModelStats) PrintWithRelativePercent(count uint, printStructure, printExample bool)
type MessageLogName ¶
type MessageLogName string
type MessageLogStats ¶
type MessageLogStats struct { LogTypeStats // contains filtered or unexported fields }
func (*MessageLogStats) Print ¶
func (a *MessageLogStats) Print()
func (*MessageLogStats) Sort ¶
func (a *MessageLogStats) Sort() []MessageLogModelStats
type MetricsLogEventName ¶
type MetricsLogEventName string
type MetricsLogModel ¶
type MetricsLogModel struct { BaseLogModel Event MetricsLogEventName }
func (*MetricsLogModel) Print ¶
func (a *MetricsLogModel) Print(printStructure, printExample bool)
type MetricsLogModelStats ¶
type MetricsLogModelStats struct { LogModelStats MetricsLogModel }
func (MetricsLogModelStats) NumLogs ¶
func (a MetricsLogModelStats) NumLogs() uint
func (*MetricsLogModelStats) Print ¶
func (a *MetricsLogModelStats) Print(printStructure, printExample bool)
func (*MetricsLogModelStats) PrintWithRelativePercent ¶
func (a *MetricsLogModelStats) PrintWithRelativePercent(count uint, printStructure, printExample bool)
type MetricsLogStats ¶
type MetricsLogStats struct { LogTypeStats // contains filtered or unexported fields }
func (*MetricsLogStats) Print ¶
func (a *MetricsLogStats) Print()
func (*MetricsLogStats) Sort ¶
func (a *MetricsLogStats) Sort() []MetricsLogModelStats
type UnknownLogModel ¶
type UnknownLogModel struct {
BaseLogModel
}
func (*UnknownLogModel) Print ¶
func (a *UnknownLogModel) Print(printStructure, printExample bool)
type UnknownLogModelStats ¶
type UnknownLogModelStats struct { LogModelStats UnknownLogModel }
func (UnknownLogModelStats) NumLogs ¶
func (a UnknownLogModelStats) NumLogs() uint
func (*UnknownLogModelStats) Print ¶
func (a *UnknownLogModelStats) Print(printExample bool)
func (*UnknownLogModelStats) PrintWithRelativePercent ¶
func (a *UnknownLogModelStats) PrintWithRelativePercent(count uint, printExample bool)
type UnknownLogStats ¶
type UnknownLogStats struct { LogTypeStats // contains filtered or unexported fields }
func (*UnknownLogStats) Print ¶
func (a *UnknownLogStats) Print()
func (*UnknownLogStats) Sort ¶
func (a *UnknownLogStats) Sort() []UnknownLogModelStats