[Elastic Agent] Monitor Filebeat Inputs#5077
Conversation
🌐 Coverage report
|
|
/test |
| @@ -0,0 +1,10 @@ | |||
| title: Elastic Agent | |||
| dataset: elastic_agent.filebeat_input | |||
There was a problem hiding this comment.
@cmacknz Is this just a temporary solution? This seems to be monitoring data of v2 inputs? Will this all go under elastic_agent.inputs or similar in the future?
There was a problem hiding this comment.
Hey @cmacknz @andrewkroh, I also need suggestion/direction on the name of the datastream as well, whether I need to create this new datastream filebeat_input or instead use existing elastic_agent datastream which is currently being used to send filebeat's /stats metrics.
Basically the field mappings in current PR were supposed to be used in conjunction with agent's inbuilt monitoring using http json metricset which monitors filebeat's /inputs endpoint. The PR is here: elastic/elastic-agent#2171 and would also need review
If I use this new datastream filebeat_input inside the agent's configuration instead of fixedAgentName and run the stack, I get following error during indexing:
{\"type\":\"security_exception\",\"reason\":\"action [indices:admin/auto_create] is unauthorized for API key id [j0XuAYYBIxEvrsej-8Ob] of user [elastic/fleet-server] on indices [metrics-elastic_agent.filebeat_input-default], this action is granted by the index privileges [auto_configure,create_index,manage,all]\"}, dropping event!"
This seems to be related to elastic/elastic-agent#1814
If I use existing datastream elastic_agent and add all the fields mapping from this PR to elastic_agent datastream, it seem to work fine.
Also, whether we want to use TSDS or not since the CI is failing from usage of time_series mode probably due to current minimum version 7.16.0.
There was a problem hiding this comment.
It definitely sounds like the path of least resistance would be to add these to the existing metrics-elastic_agent.filebeat-default data stream (without using TSDS). This avoids the issues related to permissions and allows the integration package to continue having a 7.x compatibility constraint.
This seems to be monitoring data of v2 inputs?
It's not strictly FB v2 inputs. Any Filebeat input regardless of the Filebeat interface used is eligible expose metrics. I think that all the ones with metrics happen to be implemented with Filebeat input v2 today. My expectation is that in the future we'll update Filebeat to publish metrics through the Agent V2 control interface at which time this metric collection can be removed.
There was a problem hiding this comment.
This is hopefully temporary (on a to be determined time scale), we want to change the structure of the monitoring indexes because they are hard coded directly into Fleet right now. The path of least resistance here is definitely to add these to metrics-elastic_agent.filebeat-default.
- Issue discussion how we should change the monitoring index structure V2: Elastic agent monitoring data stream names should not be per process elastic-agent#1814. Read from V2: Elastic agent monitoring data stream names should not be per process elastic-agent#1814 (comment)
- We still need a path forward for collecting application level metrics in V2 without starting more and more Beat inputs to do it. We have an issue for discussing this as well but not concrete decisions yet. Determine path forward for collection of metrics for components/units elastic-agent#2181
There was a problem hiding this comment.
Reading all the above, my current preference would be using filebeat_input as proposed in the PR and fix the permission issue in Fleet (hardcode). I expect as soon as v2 is fully done, data is likely shipped into input data stream but there might be breaking change, because of this the filebeat_input seems to be a good temporary solution. Also lets make sure we treat this as a beta data stream. For 7.16, I would expect this to only land in version > 8.7 or similar.
The part I worry about putting it into filebeat is that it could lead to potential conflicts and we ship 2 different datasets into the same data stream which is a bit against the principles.
There was a problem hiding this comment.
Thanks for the clarification guys!
So if we intend to use new filebeat_input datastream itself, I have updated this PR and also elastic/elastic-agent#2171 to reflect filebeat_input datastream.
@ruflin @cmacknz to fix the permission issue in Fleet, may I know if this is the right place to add this new datastream?
https://github.com/elastic/kibana/blob/c5f20721e1879f1ebe161b0fa3b207f10ed2b6f7/x-pack/plugins/fleet/common/constants/agent_policy.ts#L15-L28
If so, I can work on a quick PR to add it.
We are targeting the filebeats inputs monitoring feature for 8.7 release, so any help would be appreciated to get it done. Thanks!
There was a problem hiding this comment.
Mixing multiple datasets into the same datastream is something we should avoid, so I agree with Ruflin here in using a separate filebeat_input Beta datastream.
Here's an example of adding the new index to Fleet elastic/kibana@5d5603a
Note that if you make the change there I believe you will get both a logs and a metrics datastream. The logs datastream will effectively be unused so we may not actually want it created. There's nothing explicitly wrong with it being empty though. FYI @kpollich as well.
There was a problem hiding this comment.
Thanks for the clarification and sharing the example @cmacknz
I have now added logs datastream to this PR as well.
Also I have created PR elastic/kibana#149974 to add new index. @kpollich could you please review it?
There was a problem hiding this comment.
Thanks @nchaulet!
@AndersonQ / @michel-laterman Could you please review/approve this PR and also elastic/elastic-agent#2171
leehinman
left a comment
There was a problem hiding this comment.
LGTM
Non-blocking suggestion to use the external definition for the ECS fields.
| footnote: "Examples: If Metricbeat is running on an EC2 host and fetches data from its host, the cloud info contains the data about this machine. If Metricbeat runs on a remote machine outside the cloud and fetches data from a service running in the cloud, the field contains cloud data from the machine the service is running on." | ||
| type: group | ||
| fields: | ||
| - name: account.id |
There was a problem hiding this comment.
Is there a reason not to have ECS fields like cloud.account.id use the external definition? This isn't blocking but it does make long term support easier and helps prevent type conflicts.
There was a problem hiding this comment.
I need to explore the reason, but it looks like, for this package, all datastreams follow this convention, i.e., defining cloud related fields inside agent.yml. Maybe its worth creating an issue to replace all with ECS external definition instead.
|
Package elastic_agent - 1.5.0 containing this change is available at https://epr.elastic.co/search?package=elastic_agent |
What does this PR do?
Add new datastream
filebeat_inputto collect filebeat input metrics by monitoring filebeat's/inputs/API endpoint. The endpoint currently supports 4 inputsMost metrics/fields are dynamically mapped based on the naming convention.
Elastic Agent will then monitor the filebeat's
/inputs/when Update agent monitoring config to support /inputs of filebeat elastic-agent#2171 is mergedLocal Tests
cat packages/elastic_agent/data_stream/filebeat_input_metrics/agent/stream/stream.yml.hbspackages/elastic_agent/data_stream/filebeat_input_metrics/manifest.ymlpackages/elastic_agent/manifest.yml:aws-s3input type (such asaws.s3access)Elastic Agentintegration. This should create filebeat input metric events under datastreammetrics-elastic_agent.filebeat_input-defaultChecklist
changelog.ymlfile.Related issues