Documentation ¶
Index ¶
- Constants
- Variables
- func LogMatchesRule(log *Log, rule *LogRule) bool
- func LogRuleToVerdict(rule *LogRule) int
- func LogVerdict(log *Log, rules []*LogRule) int
- func LogVerdictToString(verdict int) string
- func SortedKeys[K cmp.Ordered, V any](m map[string]V) []string
- func SortedKeysWithFunc[K comparable, V any](m map[K]V, cmp func(a, b K) int) []K
- type Database
- type DatabaseConfig
- type Log
- type LogFieldMatcher
- type LogRule
- type LogRules
- type LokiQueryResult
- type LokiQueryResultData
- type LokiQueryResultDataResult
Constants ¶
View Source
const ( LogVerdictUnknown int = iota LogVerdictHam LogVerdictSpam LogVerdictNothing NumLogVerdicts )
Variables ¶
View Source
var ErrHashNotFound = errors.New("specified hash not found")
View Source
var ErrRuleNotFound = errors.New("specified rule not found")
Functions ¶
func LogMatchesRule ¶
func LogRuleToVerdict ¶
func LogVerdict ¶
func LogVerdictToString ¶
func SortedKeysWithFunc ¶
func SortedKeysWithFunc[K comparable, V any](m map[K]V, cmp func(a, b K) int) []K
Types ¶
type Database ¶
type Database struct { // TODO: There should be really locking here too? // log fetching is probably the more common thing though LogRules *LogRules // contains filtered or unexported fields }
func NewDatabaseFromFile ¶
func NewDatabaseFromFile(config DatabaseConfig, path string) (db *Database, err error)
type DatabaseConfig ¶
type Log ¶
type Log struct { Timestamp int64 Time time.Time Stream map[string]string StreamKeys []string Fields map[string]interface{} FieldsKeys []string Message string RawMessage string // contains filtered or unexported fields }
func (*Log) MatchesFTS ¶
type LogFieldMatcher ¶
type LogFieldMatcher struct { Field string Op string Value string // contains filtered or unexported fields }
func (*LogFieldMatcher) Match ¶
func (self *LogFieldMatcher) Match(s string) bool
func (*LogFieldMatcher) MatchesFTS ¶
func (self *LogFieldMatcher) MatchesFTS(s string) bool
type LogRule ¶
type LogRule struct { // Id zero is reserved 'not saved' ID int // Rule may or may not be disabled Disabled bool // Is the result interesting, or not? Ham bool // List of matchers the rule matches against Matchers []LogFieldMatcher // Comment (if any) Comment string // Version of the rule; any time the rule is changed, the // version is incremented Version int }
func (*LogRule) MatchesFTS ¶
type LogRules ¶
type LogRules struct { Rules []*LogRule Version int // Reversed rules - these are always available if Rules are Reversed []*LogRule `json:"-"` // contains filtered or unexported fields }
func NewLogRules ¶
type LokiQueryResult ¶
type LokiQueryResult struct { Status string `json:"status"` Data *LokiQueryResultData `json:"data"` }
type LokiQueryResultData ¶
type LokiQueryResultData struct { ResultType string `json:"resultType"` Result []LokiQueryResultDataResult `json:"result"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.