in cmd/collector/config/config.go [418:459]
func (j *JournalTarget) Validate() error {
if j.Database == "" {
return errors.New("database must be set")
}
if j.Table == "" {
return errors.New("table must be set")
}
haveFirstFilter := false
for _, filter := range j.Matches {
if filter == "" {
return errors.New("match must have a value")
}
if filter == "+" {
if !haveFirstFilter {
return errors.New("matches must not start with +")
}
continue
}
splitVals := strings.Split(filter, "=")
if len(splitVals) != 2 {
return fmt.Errorf("match %s must be in the format key=value", filter)
}
if splitVals[0] == "" {
return fmt.Errorf("match %s must have a key", filter)
}
if splitVals[1] == "" {
return fmt.Errorf("match %s must have a value", filter)
}
haveFirstFilter = true
}
for _, parserName := range j.Parsers {
if !parser.IsValidParser(parserName) {
return fmt.Errorf("parsers %s is not a valid parser", parserName)
}
}
return nil
}