mirror of
https://github.com/netsampler/goflow2.git
synced 2024-05-06 15:54:52 +00:00
Merge pull request #25 from netsampler/feature/enricher-sampling
Enricher can set sampling rate
This commit is contained in:
@ -43,6 +43,8 @@ var (
|
||||
LogLevel = flag.String("loglevel", "info", "Log level")
|
||||
LogFmt = flag.String("logfmt", "normal", "Log formatter")
|
||||
|
||||
SamplingRate = flag.Int("samplingrate", 0, "Set sampling rate (values > 0)")
|
||||
|
||||
Format = flag.String("format", "json", fmt.Sprintf("Choose the format (available: %s)", strings.Join(format.GetFormats(), ", ")))
|
||||
Transport = flag.String("transport", "file", fmt.Sprintf("Choose the transport (available: %s)", strings.Join(transport.GetTransports(), ", ")))
|
||||
|
||||
@ -163,6 +165,10 @@ func main() {
|
||||
|
||||
MapFlow(dbAsn, dbCountry, msg)
|
||||
|
||||
if *SamplingRate > 0 {
|
||||
msg.SamplingRate = uint64(*SamplingRate)
|
||||
}
|
||||
|
||||
key, data, err := formatter.Format(msg)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
|
Reference in New Issue
Block a user