func (r *RuleRouter) Route(msg map[string]interface{}) map[string]interface{} {
	outputs := []map[string]interface{}{}
	for _, rule := range r.rules {
		if rule.Matches(msg) {
			outputs = append(outputs, rule.OutputFor(msg))
		}
	}
	return map[string]interface{}{
		"team":        teamName,
		"kv_version":  kv.Version,
		"kv_language": "go",
		"routes":      outputs,
	}
}
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.
package router
import (
	"fmt"
	"io/ioutil"
	"os"
	kv "gopkg.in/Clever/kayvee-go.v6"
)
var teamName string
func init() {
	teamName = os.Getenv("_TEAM_OWNER")
	if teamName == "" {
		teamName = "UNSET"
	}
}
func setDefaults(output map[string]interface{}) map[string]interface{} {
	otype, ok := output["type"].(string)
	if !ok {
		return output
	}
	switch otype {
	case "metrics":
		fallthrough
	case "alerts":
		if _, ok := output["value_field"]; !ok {
			output["value_field"] = "value"
		}
	}
	return output
}