aboutsummaryrefslogtreecommitdiff
path: root/haminer.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-08-15 20:13:55 +0700
committerShulhan <ms@kilabit.info>2022-08-15 20:13:55 +0700
commit8a6eaebb36c0761b21398e72d934c072ac67fa7f (patch)
tree35150d19108888fb2c85b6d4743411121de4e493 /haminer.go
parent2965b17ccc24abde2346c20ee1f9384ae6e12f20 (diff)
downloadhaminer-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 'haminer.go')
-rw-r--r--haminer.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/haminer.go b/haminer.go
index 4864a97..10209d3 100644
--- a/haminer.go
+++ b/haminer.go
@@ -47,11 +47,15 @@ func NewHaminer(cfg *Config) (h *Haminer) {
}
func (h *Haminer) createForwarder() {
- if len(h.cfg.InfluxAPIWrite) > 0 {
- fwder := NewInfluxdbClient(h.cfg.InfluxAPIWrite)
-
- h.ff = append(h.ff, fwder)
+ if len(h.cfg.Influxd.Url) == 0 {
+ return
}
+
+ var (
+ fwder = NewInfluxdbClient(&h.cfg.Influxd)
+ )
+
+ h.ff = append(h.ff, fwder)
}
// Start will listen for UDP packet and start consuming log, parse, and