mqttbeat
mqttbeat copied to clipboard
Sanity check for topics_subscribe
Running with this config:
topics_subscribe:
- /events
produces this error:
rclarke@es-rclarke:mqttbeat$ mqttbeat -e -v -c ~/elastic/temp/mqttbeat.yml
2018/02/20 11:01:55.252501 beat.go:470: INFO Home path: [/home/rclarke/elastic/repos/go/src/github.com/nathan-k-/mqttbeat] Config path: [/home/rclarke/elastic/repos/go/src/github.com/nathan-k-/mqttbeat] Data path: [/home/rclarke/elastic/repos/go/src/github.com/nathan-k-/mqttbeat/data] Logs path: [/home/rclarke/elastic/repos/go/src/github.com/nathan-k-/mqttbeat/logs]
2018/02/20 11:01:55.252532 beat.go:495: INFO Beat metadata path: /home/rclarke/elastic/repos/go/src/github.com/nathan-k-/mqttbeat/data/meta.json
2018/02/20 11:01:55.252582 beat.go:477: INFO Beat UUID: 067ea9df-546b-4d58-8009-37205673334c
2018/02/20 11:01:55.252595 beat.go:239: INFO Setup Beat: mqttbeat; Version: 1.0.0
2018/02/20 11:01:55.252607 processor.go:49: DBG Processors:
2018/02/20 11:01:55.252623 beat.go:250: DBG Initializing output plugins
2018/02/20 11:01:55.252690 metrics.go:23: INFO Metrics logging every 30s
2018/02/20 11:01:55.252759 client.go:123: INFO Elasticsearch url: https://*****:****
2018/02/20 11:01:55.252965 logger.go:18: DBG start pipeline event consumer
2018/02/20 11:01:55.252982 pipeline.go:96: INFO Publisher name: es-rclarke
2018/02/20 11:01:55.252991 publish.go:100: INFO Publisher name: es-rclarke
2018/02/20 11:01:55.253024 mqttbeat.go:34: INFO BROKER url: tcp://hassio:8883
2018/02/20 11:01:55.253033 mqttbeat.go:39: INFO BROKER username: hassio
2018/02/20 11:01:55.257520 mqttbeat.go:53: INFO MQTT Client connected: true
panic: runtime error: index out of range
goroutine 29 [running]:
github.com/nathan-k-/mqttbeat/beater.ParseTopics(0xc42007f270, 0x1, 0x1, 0x0)
/home/rclarke/elastic/repos/go/src/github.com/nathan-k-/mqttbeat/beater/mqttbeat.go:161 +0x20b
github.com/nathan-k-/mqttbeat/beater.(*Mqttbeat).subscribeOnConnect(0xc42011a200, 0x1e254e0, 0xc4200ab180)
/home/rclarke/elastic/repos/go/src/github.com/nathan-k-/mqttbeat/beater/mqttbeat.go:58 +0x45
github.com/nathan-k-/mqttbeat/beater.(*Mqttbeat).(github.com/nathan-k-/mqttbeat/beater.subscribeOnConnect)-fm(0x1e254e0, 0xc4200ab180)
/home/rclarke/elastic/repos/go/src/github.com/nathan-k-/mqttbeat/beater/mqttbeat.go:36 +0x3e
created by github.com/nathan-k-/mqttbeat/vendor/github.com/eclipse/paho%2emqtt%2egolang.(*client).Connect.func1
/home/rclarke/elastic/repos/go/src/github.com/nathan-k-/mqttbeat/vendor/github.com/eclipse/paho.mqtt.golang/client.go:242 +0xa32
The correct configuration should define the QoS:
topics_subscribe:
- /events?0
This is a very confusing error and it can be difficult to identify the root cause - would it be possible to put in some sanity check for the configuration at this point and indicate that the topics_subscribe
is invalid at this point?