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
- func UnmarshalJSONFromPath(target any, path string) error
- type ArraySource
- type BulkRuleMatcher
- type Database
- func (self *Database) Add(r LogRule) error
- func (self *Database) AddOrUpdate(rule LogRule) error
- func (self *Database) ClassifyHash(hash uint64, ham bool) error
- func (self *Database) Delete(rid int) error
- func (self *Database) Load() error
- func (self *Database) LogCount() int
- func (self *Database) Logs() ([]*Log, error)
- func (self *Database) RuleCount(rid int) int
- type Log
- type LogFieldMatcher
- type LogRule
- type LogRules
- type LogSource
- type LokiQueryResult
- type LokiQueryResultData
- type LokiQueryResultDataResult
- type LokiSource
Constants ¶
View Source
const ( LogVerdictUnknown int = iota LogVerdictHam LogVerdictSpam LogVerdictNothing NumLogVerdicts )
Variables ¶
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
func UnmarshalJSONFromPath ¶
Types ¶
type ArraySource ¶
func (*ArraySource) Load ¶
func (self *ArraySource) Load() ([]*Log, error)
type BulkRuleMatcher ¶
type BulkRuleMatcher struct {
// contains filtered or unexported fields
}
func NewBulkRuleMatcher ¶
func NewBulkRuleMatcher(rules []*LogRule) *BulkRuleMatcher
func (*BulkRuleMatcher) ToRule ¶
func (self *BulkRuleMatcher) ToRule(log *Log) *LogRule
type Database ¶
type Database struct { // This mutex guards log rules and logs; configuration is assumed to be static sync.Mutex // Where is this file saved Path string `json:"-"` Source LogSource `json:"-"` LogRules LogRules // contains filtered or unexported fields }
func (*Database) AddOrUpdate ¶
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 ¶
func (*LogRule) SourceString ¶
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"` }
type LokiSource ¶
func (*LokiSource) Load ¶
func (self *LokiSource) Load() ([]*Log, error)
Click to show internal directories.
Click to hide internal directories.