Open shadowbq opened 5 years ago
type Config struct {
[..]
IncludePatterns []*regexp.Regexp `mapstructure:"include_patterns"`
[..]
}
if ( s.config.IncludePatterns blah blah is set )
{
if matchExps(l, s.config.IncludePatterns) {
s.logger.Write(syslog.Packet{
Severity: s.config.Severity,
Facility: s.config.Facility,
Time: time.Now(),
Hostname: s.logger.ClientHostname,
Tag: tag,
Message: l,
})
log.Tracef("Forwarding line: %s", l)
} else {
log.Tracef("Not Forwarding line: %s", l)
}
}
else
{
if !matchExps(l, s.config.ExcludePatterns) {
s.logger.Write(syslog.Packet{
Severity: s.config.Severity,
Facility: s.config.Facility,
Time: time.Now(),
Hostname: s.logger.ClientHostname,
Tag: tag,
Message: l,
})
log.Tracef("Forwarding line: %s", l)
} else {
log.Tracef("Not Forwarding line: %s", l)
}
}
There are situations where we dont want the entire log file, (catalina/tomcat) to dump into remote syslog.
I know there was a previous issue thar was complicated, but this could just be implemented with a config that fails if both
includes_patterns
andexcludes_patterns
both exist to at least add value.