diff options
| author | Shulhan <ms@kilabit.info> | 2022-08-15 20:13:55 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-08-15 20:13:55 +0700 |
| commit | 8a6eaebb36c0761b21398e72d934c072ac67fa7f (patch) | |
| tree | 35150d19108888fb2c85b6d4743411121de4e493 /config.go | |
| parent | 2965b17ccc24abde2346c20ee1f9384ae6e12f20 (diff) | |
| download | haminer-8a6eaebb36c0761b21398e72d934c072ac67fa7f.tar.xz | |
all: add support for influxd API v2
This changes replace the "influxdb_api_write" with new section
`[forwarder "influxd"]`.
The section contains version, url, org, bucket, user, password, and
token.
The version field define the API version to be used when writing log
to Influxd.
Diffstat (limited to 'config.go')
| -rw-r--r-- | config.go | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -31,6 +31,8 @@ const ( // Config define options to create and run Haminer instance. type Config struct { + Influxd InfluxdConfig + // Listen is the address where Haminer will bind and receiving // log from HAProxy. Listen string `ini:"haminer::listen"` @@ -44,9 +46,6 @@ type Config struct { // output. RequestHeaders []string `ini:"haminer::capture_request_header"` - // InfluxAPIWrite define HTTP API to write to Influxdb. - InfluxAPIWrite string `ini:"haminer::influxdb_api_write"` - HttpUrl []string `ini:"preprocess:tag:http_url"` // retags contains list of pre-processing rules for tag. @@ -99,6 +98,11 @@ func (cfg *Config) Load(path string) (err error) { return fmt.Errorf(`%s: %w`, logp, err) } + err = cfg.Influxd.init() + if err != nil { + return fmt.Errorf(`%s: %w`, logp, err) + } + return nil } @@ -143,6 +147,9 @@ func (cfg *Config) parsePreprocessTag() (err error) { if err != nil { return fmt.Errorf(`%s: %w`, logp, err) } + if retag == nil { + continue + } cfg.retags = append(cfg.retags, retag) } |
