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

Auditbeat,Metricbeat - add /inputs/ to HTTP monitoring endpoint #36971

Merged
merged 3 commits into from
Oct 27, 2023

Conversation

andrewkroh
Copy link
Member

@andrewkroh andrewkroh commented Oct 26, 2023

Proposed commit message

Make metrics published by "inputs" available through the /inputs/ route on the HTTP monitoring endpoint of Auditbeat and Metricbeat.

For Agent, include a snapshot of those metrics within the Agent diagnostics bundle as "input_metrics.json".

When running under Agent, each module instance is configured with only a single metricset. That module is given a unique id. That ID is what will be used as the id within the /inputs/ data. And that id will also be added as context to the logger that is passed into every metricset so that any log messages from a metricset can be associated back to the agent stream ID).

Relates: #36945

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

Example

AFAICT no MetricSet implementations in Metricbeat or Auditbeat register any metrics so for now you can only use this to see what instances are running.

curl "http://localhost:6060/inputs/?pretty"

[
  {
    "ephemeral_id": "86b09717-49ac-4c66-b08c-75edc3b4cffc",
    "id": "audit/system-system_audit.package-1af2373c-24b7-43b2-a9f2-8f04f803a0c6",
    "input": "system/package",
    "starttime": "2023-10-26T18:11:10.850Z"
  },
  {
    "ephemeral_id": "52965779-c346-4061-9fac-0baea45d2461",
    "id": "audit/file_integrity-fim.event-7580a9e4-e355-4a26-95c8-e49f08bd4fd0",
    "input": "file_integrity/file",
    "starttime": "2023-10-26T18:11:10.850Z"
  }
]

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Oct 26, 2023
@mergify
Copy link
Contributor

mergify bot commented Oct 26, 2023

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

@andrewkroh andrewkroh force-pushed the feature/mb/input-metrics branch from b39d465 to 526af95 Compare October 26, 2023 17:32
@elasticmachine
Copy link
Collaborator

elasticmachine commented Oct 26, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Duration: 68 min 27 sec

❕ Flaky test report

No test was executed to be analysed.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

Make metrics published by "inputs" available through the /inputs/ route
on the HTTP monitoring endpoint of Auditbeat and Metricbeat.

For Agent, include a snapshot of those metrics within the Agent diagnostics
bundle as "input_metrics.json".

When running under Agent, each module instance is configured with only a single
metricset. That module is given a unique `id`. That ID is what will be used
as the `id` within the /inputs/ data. And that `id` will also be added as context to the
logger that is passed into every metricset so that any log messages from a metricset
can be associated back to the agent stream ID).

Relates elastic#36945
For the `/inputs/` API, `input` is they key used to identify the type of "input" running.
The `module` and `metricset` keys become redundant with the addition of `input`.
I don't know of anything that relies on those fields.
@andrewkroh andrewkroh force-pushed the feature/mb/input-metrics branch from 526af95 to 74ae153 Compare October 26, 2023 18:04
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Oct 26, 2023
@andrewkroh andrewkroh marked this pull request as ready for review October 26, 2023 19:26
@andrewkroh andrewkroh requested a review from a team as a code owner October 26, 2023 19:26
@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

@andrewkroh andrewkroh merged commit fe50883 into elastic:main Oct 27, 2023
6 of 8 checks passed
@andrewkroh andrewkroh added the backport-skip Skip notification from the automated backport with mergify label Oct 27, 2023
Scholar-Li pushed a commit to Scholar-Li/beats that referenced this pull request Feb 5, 2024
…tic#36971)

Make metrics published by "inputs" available through the /inputs/ route
on the HTTP monitoring endpoint of Auditbeat and Metricbeat.

For Agent, include a snapshot of those metrics within the Agent diagnostics
bundle as "input_metrics.json".

When running under Agent, each module instance is configured with only a single
metricset. That module is given a unique `id`. That ID is what will be used
as the `id` within the /inputs/ data. And that `id` will also be added as context to the
logger that is passed into every metricset so that any log messages from a metricset
can be associated back to the agent stream ID).

Relates elastic#36945

Remove module and metricset keys from metricset metrics. 
For the `/inputs/` API, `input` is they key used to identify the type of "input" running.
The `module` and `metricset` keys become redundant with the addition of `input`.
I don't know of anything that relies on those fields.
@kunisen
Copy link
Contributor

kunisen commented Feb 22, 2024

Hi team, it seems our doc is not accurate enough:
https://www.elastic.co/guide/en/beats/packetbeat/current/protocol-metrics-packetbeat.html

These metrics are exposed under the /inputs path.

It says /inputs but actually it should be /inputs/ (with a trailing /).
If we don't specify that trailing slash, we get nothing.

We think it's a doc bug, and can we have someone from beats team to help us fix this? 🙏
Please let us know if the above understanding is wrong and thanks!

cc @jasonyoum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auditbeat backport-skip Skip notification from the automated backport with mergify Metricbeat Metricbeat Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants