mirror of
https://github.com/openobserve/goflow2.git
synced 2025-11-02 21:13:27 +00:00
Custom map flow fields (#36)
* adds dataframe link decoding * can map NetFlow/IPFIX fields and bytes sections from sFlow/packets to any field inside the protobuf * add CLI argument for loading a mapping yaml file
This commit is contained in:
@@ -3,6 +3,7 @@ package utils
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"strconv"
|
||||
"time"
|
||||
@@ -11,9 +12,20 @@ import (
|
||||
decoder "github.com/netsampler/goflow2/decoders"
|
||||
"github.com/netsampler/goflow2/decoders/netflow"
|
||||
flowmessage "github.com/netsampler/goflow2/pb"
|
||||
"github.com/netsampler/goflow2/producer"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
type ProducerConfig *producer.ProducerConfig
|
||||
|
||||
func LoadMapping(f io.Reader) (ProducerConfig, error) {
|
||||
config := &producer.ProducerConfig{}
|
||||
dec := yaml.NewDecoder(f)
|
||||
err := dec.Decode(config)
|
||||
return config, err
|
||||
}
|
||||
|
||||
func GetServiceAddresses(srv string) (addrs []string, err error) {
|
||||
_, srvs, err := net.LookupSRV("", "", srv)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user