Skip to content

[9.0](backport #45128) [kafka] Handle configuration errors#45282

Merged
khushijain21 merged 4 commits into9.0from
mergify/bp/9.0/pr-45128
Jul 11, 2025
Merged

[9.0](backport #45128) [kafka] Handle configuration errors#45282
khushijain21 merged 4 commits into9.0from
mergify/bp/9.0/pr-45128

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify Bot commented Jul 10, 2025

Proposed commit message

This PR handles kafka configuration errors by dropping the message. Since configuration errors are of permanent error type and should not be retried.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

Bring kafka server up using following command

cd filebeat
mage docker:composeUp

Use following filebeat.yml

filebeat.inputs:
  - type: filestream
    id: filestream-input-id
    enabled: true
    paths:
      - ./test.log
    file_identity.native: ~
    prospector.scanner.fingerprint.enabled: false      

output:
  kafka:
    hosts: ["localhost:9092", "localhost:9094"]
    topic: beats
    max_message_bytes: 10

and you can see this error

{
  "log.level": "error",
  "@timestamp": "2025-07-02T15:28:04.373+0530",
  "log.logger": "kafka",
  "log.origin": {
    "function": "github.com/elastic/beats/v7/libbeat/outputs/kafka.(*msgRef).fail",
    "file.name": "kafka/client.go",
    "file.line": 396
  },
  "message": "Kafka (topic=beats): dropping message due to invalid configuration kafka: invalid configuration (Attempt to produce message larger than configured Producer.MaxMessageBytes: 851 > 10)",
  "service.name": "filebeat",
  "ecs.version": "1.6.0"
}

Related issues


This is an automatic backport of pull request #45128 done by [Mergify](https://mergify.com).

* [kafka] Handle configuration errors

(cherry picked from commit 23f4491)

# Conflicts:
#	libbeat/outputs/kafka/kafka_integration_test.go
@mergify mergify Bot added backport conflicts There is a conflict in the backported pull request labels Jul 10, 2025
@mergify mergify Bot requested a review from a team as a code owner July 10, 2025 06:38
@mergify mergify Bot requested review from AndersonQ and removed request for a team July 10, 2025 06:38
@mergify
Copy link
Copy Markdown
Contributor Author

mergify Bot commented Jul 10, 2025

Cherry-pick of 23f4491 has failed:

On branch mergify/bp/9.0/pr-45128
Your branch is up to date with 'origin/9.0'.

You are currently cherry-picking commit 23f4491cc.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   libbeat/outputs/kafka/client.go
	modified:   libbeat/outputs/kafka/config.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   libbeat/outputs/kafka/kafka_integration_test.go

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify Bot requested a review from VihasMakwana July 10, 2025 06:38
@mergify mergify Bot added backport conflicts There is a conflict in the backported pull request labels Jul 10, 2025
@botelastic botelastic Bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jul 10, 2025
@mergify mergify Bot mentioned this pull request Jul 10, 2025
6 tasks
@github-actions github-actions Bot added bug Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team labels Jul 10, 2025
@botelastic botelastic Bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jul 10, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@khushijain21 khushijain21 enabled auto-merge (squash) July 10, 2025 16:17
@khushijain21 khushijain21 merged commit 4a6e8df into 9.0 Jul 11, 2025
174 of 177 checks passed
@khushijain21 khushijain21 deleted the mergify/bp/9.0/pr-45128 branch July 11, 2025 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport bug conflicts There is a conflict in the backported pull request Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants