diff --git a/go.mod b/go.mod index 947517e7a..ac93af9da 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/djherbis/atime v1.0.0 github.com/dswarbrick/smart v0.0.0-20190505152634-909a45200d6d github.com/dustin/go-humanize v1.0.0 - github.com/eclipse/paho.mqtt.golang v1.3.0 + github.com/eclipse/paho.mqtt.golang v1.3.5 github.com/elastic/go-elasticsearch/v7 v7.12.0 github.com/fatih/color v1.13.0 github.com/go-ldap/ldap/v3 v3.2.4 diff --git a/go.sum b/go.sum index 5268cb77c..80c5f641f 100644 --- a/go.sum +++ b/go.sum @@ -333,8 +333,8 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 h1:YEetp8 github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/eclipse/paho.mqtt.golang v1.3.0 h1:MU79lqr3FKNKbSrGN7d7bNYqh8MwWW7Zcx0iG+VIw9I= -github.com/eclipse/paho.mqtt.golang v1.3.0/go.mod h1:eTzb4gxwwyWpqBUHGQZ4ABAV7+Jgm1PklsYT/eo8Hcc= +github.com/eclipse/paho.mqtt.golang v1.3.5 h1:sWtmgNxYM9P2sP+xEItMozsR3w0cqZFlqnNN1bdl41Y= +github.com/eclipse/paho.mqtt.golang v1.3.5/go.mod h1:eTzb4gxwwyWpqBUHGQZ4ABAV7+Jgm1PklsYT/eo8Hcc= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/elastic/go-elasticsearch/v7 v7.12.0 h1:j4tvcMrZJLp39L2NYvBb7f+lHKPqPHSL3nvB8+/DV+s= github.com/elastic/go-elasticsearch/v7 v7.12.0/go.mod h1:OJ4wdbtDNk5g503kvlHLyErCgQwwzmDtaFC4XyOxXA4= diff --git a/internal/event/target/mqtt.go b/internal/event/target/mqtt.go index d9c04bc62..0448a383f 100644 --- a/internal/event/target/mqtt.go +++ b/internal/event/target/mqtt.go @@ -209,8 +209,12 @@ func NewMQTTTarget(id string, args MQTTArgs, doneCh <-chan struct{}, loggerOnce args.MaxReconnectInterval = 10 * time.Minute } + if args.KeepAlive == 0 { + args.KeepAlive = 10 * time.Second + } + options := mqtt.NewClientOptions(). - SetClientID(""). + SetClientID(id). SetCleanSession(true). SetUsername(args.User). SetPassword(args.Password).