Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filebeat mqtt add cleansession #35806

Merged
merged 13 commits into from
Jul 14, 2023

Conversation

dramis
Copy link
Contributor

@dramis dramis commented Jun 18, 2023

What does this PR do?

Add clean_session parameter in config file of filebeat mqtt input plugin.

When clean_session is true, the state information is discarded at connect and disconnect. Setting cleansession to false keeps the state information. Default value true

Why is it important?

With clean_session to false, it's possible to keep unread message to Mqtt server.

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.

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

@dramis dramis requested a review from a team as a code owner June 18, 2023 14:56
@dramis dramis requested review from cmacknz and leehinman June 18, 2023 14:56
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jun 18, 2023
@mergify mergify bot assigned dramis Jun 18, 2023
@mergify
Copy link
Contributor

mergify bot commented Jun 18, 2023

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @dramis? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

@elasticmachine
Copy link
Collaborator

elasticmachine commented Jun 18, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-07-14T00:06:47.448+0000

  • Duration: 74 min 43 sec

Test stats 🧪

Test Results
Failed 0
Passed 7998
Skipped 757
Total 8755

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@cmacknz cmacknz requested review from ycombinator and removed request for cmacknz June 19, 2023 20:44
@cmacknz cmacknz added the Team:Elastic-Agent Label for the Agent team label Jul 7, 2023
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent (Team:Elastic-Agent)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jul 7, 2023
@@ -31,6 +31,7 @@ type mqttInputConfig struct {
ClientID string `config:"client_id" validate:"nonzero"`
Username string `config:"username"`
Password string `config:"password"`
CleanSession bool `config:"clean_session"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please run go fmt ./filebeat/input/mqtt/...?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@ycombinator
Copy link
Contributor

Hmm, the linter still does not appear to be happy with the formatting. What version of go are you running?

@ycombinator
Copy link
Contributor

Also, please remember to document the new setting in https://github.com/elastic/beats/blob/main/filebeat/docs/inputs/input-mqtt.asciidoc and add an entry in https://github.com/elastic/beats/blob/main/CHANGELOG.next.asciidoc.

dramis and others added 4 commits July 12, 2023 18:59
Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
@ycombinator
Copy link
Contributor

/test

@ycombinator
Copy link
Contributor

@dramis CI is failing due to formatting errors. Could you run mage fmt and commit the changes? I ran it locally and it looks like the formatting of filebeat/input/mqtt/config.go changed. I'm running Go version 1.19.10, as per what's in the .go-version file.

@ycombinator
Copy link
Contributor

/test

Copy link
Contributor

@ycombinator ycombinator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the contribution, @dramis!

@ycombinator ycombinator added backport-skip Skip notification from the automated backport with mergify >enhancement labels Jul 14, 2023
@ycombinator ycombinator merged commit a755bbc into elastic:main Jul 14, 2023
8 checks passed
@dramis dramis deleted the filebeat-mqtt-add-cleansession branch July 14, 2023 10:08
Scholar-Li pushed a commit to Scholar-Li/beats that referenced this pull request Feb 5, 2024
* add CleanSession parameter

* Cleansession parameter add

* correct cleansession parameter name

* Defaut clean session to True

* formating file

* Add missing documentation

* Update filebeat/docs/inputs/input-mqtt.asciidoc

Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>

* Update filebeat/docs/inputs/input-mqtt.asciidoc

Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>

* doc correction

* Update CHANGELOG.next.asciidoc

Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>

* Update filebeat/docs/inputs/input-mqtt.asciidoc

Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>

* correct formatting

---------

Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-skip Skip notification from the automated backport with mergify >enhancement Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants