Skip to content

Commit

Permalink
Add message 'max_bytes' configuration (#4537)
Browse files Browse the repository at this point in the history
  • Loading branch information
otherpirate authored and glinton committed Aug 13, 2018
1 parent 223a128 commit 434fa8d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plugins/outputs/kafka/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ type (
RequiredAcks int
// MaxRetry Tag
MaxRetry int
// Max Message Bytes
MaxMessageBytes int

Version string `toml:"version"`

Expand Down Expand Up @@ -140,6 +142,9 @@ var sampleConfig = `
## until the next flush.
# max_retry = 3
## Max message bytes, should be lower than server message.max.bytes config
# MaxMessageBytes = 0
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
Expand Down Expand Up @@ -219,6 +224,10 @@ func (k *Kafka) Connect() error {
config.Producer.Retry.Max = k.MaxRetry
config.Producer.Return.Successes = true

if k.MaxMessageBytes > 0 {
config.Producer.MaxMessageBytes = k.MaxMessageBytes
}

// Legacy support ssl config
if k.Certificate != "" {
k.TLSCert = k.Certificate
Expand Down

0 comments on commit 434fa8d

Please sign in to comment.