Skip to content

Conversation

@aleksmaus
Copy link
Contributor

Proposed commit message

Fix Packetbeat parsing mongodb OP_MSG

  • Fixes handling of OP_MSG based request/response, fixes missing "end" timestamp and "duration" field for the event.
  • Cleanup

Addresses the issue #28858 that makes packetbeat unusable for any newer thatn 5.0 version of MongoDB.
The legacy "mongodb" property is not populated and probably we should not try to map the new protocol into the legacy data structures. Instead using the document from the request BSON ecoded body to populate the "query" and "request" (if requested) fields in the format compatible with the previous implmentation for now.

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.

Related issues

Screenshots

Couple of examples of OP_MSG documents with query and request fields

Screenshot 2024-08-22 at 12 11 09 PM Screenshot 2024-08-22 at 12 12 14 PM

* Fixes handling OP_MSG based request/response, missing "end" timestamp
  and "duration" field for the event
* Cleanup
@aleksmaus aleksmaus added bug bugfix Team:Security-Deployment and Devices Deployment and Devices Team in Security Solution labels Aug 22, 2024
@aleksmaus aleksmaus requested a review from a team August 22, 2024 16:14
@aleksmaus aleksmaus requested a review from a team as a code owner August 22, 2024 16:14
@elasticmachine
Copy link
Contributor

Pinging @elastic/sec-deployment-and-devices (Team:Security-Deployment and Devices)

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Aug 22, 2024
@mergify
Copy link
Contributor

mergify bot commented Aug 22, 2024

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @aleksmaus? 🙏.
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

@aleksmaus aleksmaus added the backport-skip Skip notification from the automated backport with mergify label Aug 22, 2024
@aleksmaus aleksmaus assigned andrewkroh and unassigned andrewkroh Aug 26, 2024
@aleksmaus aleksmaus requested a review from andrewkroh August 26, 2024 19:36
Copy link
Contributor

@fearful-symmetry fearful-symmetry left a comment

Choose a reason for hiding this comment

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

I don't have a lot of MongoDB context, but the code looks fine.

@aleksmaus aleksmaus merged commit b11b86a into elastic:main Sep 4, 2024
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 bug bugfix Team:Security-Deployment and Devices Deployment and Devices Team in Security Solution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Packetbeat]Packetbeat parsing mongodb OP_MSG

6 participants