Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Router ¶
Router is an an interface for an object that can route log lines.
func NewFromConfig ¶
NewFromConfig constructs a Router using the configuration specified as yaml in `filename`. The routing rules should be placed under the "routes" key on the root-level map in the file. Validation is performed as described in parse.go.
func NewFromConfigBytes ¶ added in v6.8.0
NewFromConfigBytes constructs a Router using the configuration specified as bytes typically read from a binary file. This allows us to package kv routing yaml files into binaries like gearcmd. The routing rules should be placed under the "routes" key on the root-level map in the file. Validation is performed as described in parse.go.
type Rule ¶
type Rule struct { Name string `json:"-"` Matchers RuleMatchers `json:"matchers"` Output RuleOutput `json:"output"` }
Rule is a log routing rule
type RuleMatchers ¶
RuleMatchers describes which log lines a router rule applies to.
func (*RuleMatchers) UnmarshalYAML ¶
func (m *RuleMatchers) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals the `matchers` section of a log-routing configuration and validates it.
type RuleOutput ¶
type RuleOutput map[string]interface{}
RuleOutput describes what to do if a log line matches a rule.
type RuleRouter ¶
type RuleRouter struct {
// contains filtered or unexported fields
}
RuleRouter is an object that can route log lines according to `rules`.
func (*RuleRouter) Route ¶
func (r *RuleRouter) Route(msg map[string]interface{}) map[string]interface{}
Route returns routing metadata for the log line `msg`. The outputs (with variable substitutions performed) for each rule matched are placed under the "routes" key.