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

feat(sources): multicast udp socket support #22099

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

jorgehermo9
Copy link
Contributor

@jorgehermo9 jorgehermo9 commented Dec 31, 2024

Closes #5732

This PR is still in draft. I have a few pending TODOs and also missing tests to propertly check this. Although, the happy path is working.

In order to test this, use this vector config:

[sources.multicast_udp]
type = "socket"
mode = "udp"
address = "0.0.0.0:4242"
multicast_groups = ["224.0.0.2"]


[sinks.console]
type = "console"
inputs = ["multicast_udp"]
encoding.codec = "json"

and with this command

echo "hello" | nc 224.0.0.2 4242 -u

you can see logs in vector.
image

I would like to receive some feedback about how the configuration of this setting should look like.

Also, note that IPv6 is not supported. We can work on that, but maybe it is not worth it if no one request that.

@nomalord take a look into this please, It would be great if you can build the binary from this branch and test if it works in your systems.

@dalesample as you were the first requester of this I also ping you, just in case (although this issue was created 4 years ago)

@github-actions github-actions bot added the domain: sources Anything related to the Vector's sources label Dec 31, 2024
@nomalord
Copy link

This looks awesome🤯
As it's new years I won't be able to check our usecase until Thursday...
I will say though, that this looks like it answers our usecase exactly🙏🙏🙏🙏🙏🙏

@jorgehermo9 jorgehermo9 changed the title feat: multicast udp socket support feat(sources): multicast udp socket support Jan 2, 2025
@jorgehermo9
Copy link
Contributor Author

Hi @nomalord perhaps you could test this?

@nomalord
Copy link

nomalord commented Jan 9, 2025

I don't really have experience with rust, but I'll try to compile the feature branch and update you🥹

@pront
Copy link
Member

pront commented Jan 9, 2025

I don't really have experience with rust, but I'll try to compile the feature branch and update you🥹

Maybe this is helpful to you:

# cd /path/to/vector/repo
# brew install gh 
gh pr checkout 22099
cargo run -- --config /path/to/your/config.yaml

@jorgehermo9
Copy link
Contributor Author

Thank you for popping in @pront 😃. I have left to include some tests to validate this PR and also add documentation & changelog. I will update this as soon as I can and mark the pr as non-draft then

@github-actions github-actions bot added the domain: external docs Anything related to Vector's external, public documentation label Jan 19, 2025
@jorgehermo9
Copy link
Contributor Author

Hi @pront. Sorry for the delay, had no time these past weeks. Addressed all your comments and left a few doubts about the new changes. Feel free to resolve any conversation, just wanted to raise some things so you are aware of it.

Thanks!

@jorgehermo9
Copy link
Contributor Author

small bump in case this got forgotten @pront, I think it is almost done.

@pront
Copy link
Member

pront commented Feb 24, 2025

small bump in case this got forgotten @pront, I think it is almost done.

👍 I will take a look first thing tomorrow

@jorgehermo9
Copy link
Contributor Author

Ready to go! Thanks @pront

CC @nomalord I hope you still need this, sorry for the delay!

@pront pront enabled auto-merge March 4, 2025 16:12
@pront pront added this pull request to the merge queue Mar 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 4, 2025
@pront
Copy link
Member

pront commented Mar 4, 2025

Unfortunately some windows tests failed:
https://github.com/vectordotdev/vector/actions/runs/13661566864/job/38193708090

@jorgehermo9
Copy link
Contributor Author

Hm, It is surprising that multicast_and_unicast_udp_message fails but multicast_udp_message doesn't fail. Both uses 224.0.0.2 multicast address, so I don't think that address is the problem. The only difference is that multicast_and_unicast_udp_message sends an unicast packet after the multicast one here:

send_lines_udp_from(from, socket_address, ["test".to_string()]);

But can't understand why it is not working if multicast_udp_message is. I can only think of next_addr_any returning an invalid address... But it makes no sense :/

Is there any easy way to run windows tests from linux? Or do I have to spin up a VM and configure everything there..?

What we could do is to flag that test behind #[cfg(unix)] or delete it completely, as I think that test is a bit redundant, as we have multicast_udp_message and udp_message tests though.

@jorgehermo9
Copy link
Contributor Author

Can't understand why the error is happening, as we always bind to INADDR_ANY and not to an specific IP see google search for this error

@pront
Copy link
Member

pront commented Mar 5, 2025

Or do I have to spin up a VM and configure everything there..?

I am afraid this is the way to go.

What we could do is to flag that test behind #[cfg(unix)] or delete it completely, as I think that test is a bit redundant, as we have multicast_udp_message and udp_message tests though.

I wonder if this feature works on Windows, sounds like we never tested it on there. I have a feeling ti does but we don't want to merge it without testing it. If you don't want to go down that rabbit hole, we can start by advertising it as linux only (and apply #[cfg(unix)] everywhere).

@jorgehermo9
Copy link
Contributor Author

no problem, I will try to run it all on windows!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: external docs Anything related to Vector's external, public documentation domain: sources Anything related to the Vector's sources
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support multicast for UDP
4 participants