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

UDP prospector type with plain harvester #4452

Merged
merged 2 commits into from
Jun 23, 2017
Merged

Conversation

ruflin
Copy link
Member

@ruflin ruflin commented Jun 2, 2017

Opening this prospector mainly to show this is WIP and so I don't forget about it :-)

TODO

  • Changelog
  • Docs
  • Tests
  • Code cleanup

And even looks as following

{
  "@timestamp": "2017-05-26T11:57:17.68711727+02:00",
  "beat": {
    "hostname": "ruflin",
    "name": "ruflin",
    "version": "6.0.0-alpha2"
  },
  "message": "Hello, World!99",
  "prospector": {
    "harvester": "plain",
    "type": "udp"
  }
}

@ruflin ruflin added Filebeat Filebeat in progress Pull request is currently in progress. labels Jun 2, 2017
defer listener.Close()

//logp.Info("Now listening for logs via %s on %s", ll.config.Protocol, address)
buffer := make([]byte, 1000)
Copy link
Member Author

Choose a reason for hiding this comment

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

@hartfordfive Any recommendation on the value here?

Copy link
Contributor

@hartfordfive hartfordfive Jun 7, 2017

Choose a reason for hiding this comment

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

@ruflin I realize in theory you could have up to 65507 bytes of data in IPv4 (removing UDP and IP header overhead of 20 and 8 bytes respectively) although I know that you risk having fragmentation of this because of MTU (which I guess is generally between 1400 and 1500 - not taking into account jumbo frames). Considering this should only be done locally on the server, i figured this shouldn't happen, so thus why I chose a slightly larger 2048 or 4096 bytes buffer size.

I know many applications tend to limit to <= 1024 bytes for a UDP buffer (especially for cross-host communication), although from what I've tested so far, I haven't had messages that were cut off, but I'm aware this could happen, especially if you're going form one host to another even on the same rack. You could potentially stick with the 1024 byte buffer as a default but allow users to specify the port and the buffer size via the prospector config parameters.

I think it would maybe be nice to have someone else give some feedback on this, especially from the networking stack side to confirm if this is a reasonable assumption or not. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for sharing the thoughts. I set it 1024 for the moment and made it configurable. Time will tell and we can still change the default.

event := common.MapStr{
"message": string(buffer[:length]),
"prospector": common.MapStr{
"harvester": "plain",
Copy link
Member Author

Choose a reason for hiding this comment

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

@tsg I'm asking myself if this should be code? Other options here could be json.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need a "harverster" key? Maybe we add it when we have more of them.

I'm thinking that, for example, JSON can be accomplished with the processor, so I'm not sure harvester support for it is needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't need it at the moment an can still add it later.

@ruflin ruflin force-pushed the udp-prospector branch 3 times, most recently from ce9a97e to f0ce934 Compare June 14, 2017 07:19
@ruflin ruflin changed the title [WIP] UDP prospector type with plain harvester UDP prospector type with plain harvester Jun 14, 2017
@ruflin ruflin added review and removed in progress Pull request is currently in progress. labels Jun 14, 2017
#- type: udp

# Maximum size of each message sent over udp
#max_message_size: 1024
Copy link
Contributor

Choose a reason for hiding this comment

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

Two things here:

  • I think it would be more clear if it would say "Maximum size of the message received over UDP".
  • 1024 seems low, UDP can go up to 65K. How about 10K, which should be large enough for most usecases but still small enough to not be noticeable in the mem usage?

Copy link
Member Author

Choose a reason for hiding this comment

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

I set it to 10240 now. 1024 was based on the discussion here.

Copy link
Contributor

@tsg tsg left a comment

Choose a reason for hiding this comment

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

Left a minor comment.

@elastic elastic deleted a comment from codecov bot Jun 20, 2017
@ruflin ruflin force-pushed the udp-prospector branch 2 times, most recently from 42100f1 to cfac655 Compare June 23, 2017 05:50
Copy link
Contributor

@exekias exekias left a comment

Choose a reason for hiding this comment

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

Left a comment on default value, LGTM apart from that

ForwarderConfig: harvester.ForwarderConfig{
Type: "udp",
},
MaxMessageSize: 1024,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be 10240?

Copy link
Member Author

Choose a reason for hiding this comment

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

changed, thanks for spotting.

…get about it :-)

TODO

* [x] Changelog
* [ ] Docs
* [x] Tests
* [x] Code cleanup

And even looks as following

```
{
  "@timestamp": "2017-05-26T11:57:17.68711727+02:00",
  "beat": {
    "hostname": "ruflin",
    "name": "ruflin",
    "version": "6.0.0-alpha2"
  },
  "message": "Hello, World!99",
  "prospector": {
    "harvester": "plain",
    "type": "udp"
  }
}
```
@exekias
Copy link
Contributor

exekias commented Jun 23, 2017

WFG

@exekias exekias merged commit 51d8637 into elastic:master Jun 23, 2017
@ruflin ruflin deleted the udp-prospector branch June 27, 2017 06:18
@dedemorton dedemorton mentioned this pull request Jul 25, 2017
42 tasks
@dedemorton
Copy link
Contributor

Can I remove the needs_docs tag? Is #4940 sufficient, or is additional doc required?

@ruflin
Copy link
Member Author

ruflin commented Sep 20, 2017

@dedemorton I was hoping for more docs that also shows how to configure the host for example. But I don't know how this fits into our current doc model of prospectors. Perhaps worth to discuss quickly over zoom?

@dedemorton dedemorton mentioned this pull request Jan 22, 2018
37 tasks
@dedemorton
Copy link
Contributor

I'm going to remove the needs_docs label here in favor of tracking the work in #5632

@dedemorton dedemorton mentioned this pull request Mar 13, 2018
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants