Skip to content

Commit 434fa8d

Browse files
otherpirateglinton
authored andcommitted
Add message 'max_bytes' configuration (#4537)
1 parent 223a128 commit 434fa8d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

plugins/outputs/kafka/kafka.go

+9
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ type (
3737
RequiredAcks int
3838
// MaxRetry Tag
3939
MaxRetry int
40+
// Max Message Bytes
41+
MaxMessageBytes int
4042

4143
Version string `toml:"version"`
4244

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

227+
if k.MaxMessageBytes > 0 {
228+
config.Producer.MaxMessageBytes = k.MaxMessageBytes
229+
}
230+
222231
// Legacy support ssl config
223232
if k.Certificate != "" {
224233
k.TLSCert = k.Certificate

0 commit comments

Comments
 (0)