-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Heartbeat] Add fields to example heartbeat autodiscover usage. #9901
Conversation
It's useful when using autodiscovered endpoints to have container metadata. It's not obvious how to do this, so we document some of the fields one might use here in the docs. This addresses a comment brought up on discuss in https://discuss.elastic.co/t/autodiscover-and-metadata/162980/1
@@ -14,6 +14,10 @@ heartbeat.autodiscover: | |||
hosts: ["${data.host}:${data.port}"] | |||
schedule: "@every 1s" | |||
timeout: 1s | |||
fields: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field names use used as example are not ECS which I would not recommend.
When using autodiscovery, I would expect some of the field below to already be added. @exekias can you comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for the late answer folks, this got lost in my inbox...
uhm, from what I know autodiscover should be enriching events coming from it with these fields, but that needs to be implemented by Hearbeat:
Autodiscover will pass you a meta
object (common.MapStrPointer) with all the metadata, the adapter should inject this data to all the resulting events of the runner. Look at how Metricbeat is doing it, for instance:
- Get the metadata in the factory:
beats/metricbeat/mb/module/factory.go
Line 43 in 204264a
func (r *Factory) Create(p beat.Pipeline, c *common.Config, meta *common.MapStrPointer) (cfgfile.Runner, error) { - Pass it to the pipeline connector:
beats/metricbeat/mb/module/connector.go
Line 63 in 204264a
DynamicFields: c.dynamicFields,
libbeat will take these fields and put them in the field. Happy to help on this if needed!
@ruflin I've updated the docs to use ECS fields. I didn't add the labels because we don't have a great answer there. Interpolating them won't create an object, just a weird string. I think this is a temporary solution, I agree we need a better one in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jenkins, test this
Closing in favor of #10258 |
It's useful when using autodiscovered endpoints to have container metadata. It's not obvious how to do this, so we document some of the fields one might use here in the docs.
This addresses a comment brought up on discuss in https://discuss.elastic.co/t/autodiscover-and-metadata/162980/1