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

fix logstash cgroup mapping #33131

Merged
merged 7 commits into from
Sep 30, 2022

Conversation

rpasche
Copy link
Contributor

@rpasche rpasche commented Sep 20, 2022

Related to elastic/kibana#142179

What does this PR do?

It fixes the the mapping of .monitoring-logstash-8-mb, so that Stack Monitoring for Logstash is working again.

I noticed, that the mapping of logstash is broken. The aliases of the cgroup object are allocated on the wrong level.

Today, the aliases is located at logstash_stats.os.cpu.stat, but it should be located at logstash_stats.os.cgroup.cpu.stat. So that the path of the alias are again matching.

Additionally, the metric for cfs_quota_micros was not fetched by the node_stats of logstash. But this metric is also used withih Kibana to calculate another metric. (see example at https://github.com/elastic/kibana/blob/main/x-pack/plugins/monitoring/server/lib/metrics/logstash/metrics.ts#L265 and https://github.com/elastic/kibana/blob/main/x-pack/plugins/monitoring/server/lib/metrics/logstash/metrics.ts#L355)

Why is it important?

It is needed to fix Stack Monitoring to show correct graphs again.

Checklist

No "code" checks have been done. My only "code" change I used was to add the cfs_quota_micros within the node_stats/data.go file (to unmarshal that field from JSON object). The changes to the mapping have only been done by me - so far - manually directly within a dev cluster (within the .monitoring-logstash-8-mb index template. (see screenshots below)

Sorry... nothing from below.

  • 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.

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Issues and PR from within Logstash

Use cases

Screenshots

new field cfs_quota_micros added

image

aliases moved (here, only the new added)

image

Results in Stack Monitoring (tested in 8.4.1)

CPU Utilization shown again

image

CGroup stats showing real values (and not N/A)

image

Logs

@rpasche rpasche requested a review from a team as a code owner September 20, 2022 13:41
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Sep 20, 2022
@mergify
Copy link
Contributor

mergify bot commented Sep 20, 2022

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

@elasticmachine
Copy link
Collaborator

elasticmachine commented Sep 20, 2022

💚 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

  • Start Time: 2022-09-30T03:05:20.276+0000

  • Duration: 48 min 0 sec

Test stats 🧪

Test Results
Failed 0
Passed 3859
Skipped 887
Total 4746

💚 Flaky test report

Tests succeeded.

🤖 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!)

- docs/fields.asciidoc
- module/logstash/fields.go
@klacabane klacabane requested review from klacabane and removed request for klacabane September 21, 2022 08:51
@smith smith added the Team:Infra Monitoring UI - DEPRECATED Infrastructure Monitoring UI team - DEPRECATED - Use Team:Monitoring label Sep 23, 2022
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Sep 23, 2022
@matschaffer matschaffer self-requested a review September 27, 2022 08:37
@matschaffer
Copy link
Contributor

/test

@matschaffer matschaffer added the backport-v8.5.0 Automated backport with mergify label Sep 27, 2022
@matschaffer
Copy link
Contributor

Thanks for digging into this @rpasche - I'll see if I can first find a v1 cgroups setup I can use to test this directly. If not I'll have to build a container that includes elastic/logstash#14537.

The mappings for these indices live in https://github.com/elastic/elasticsearch/blob/main/x-pack/plugin/core/src/main/resources/monitoring-logstash.json (for logstash internal collection) and https://github.com/elastic/elasticsearch/blob/main/x-pack/plugin/core/src/main/resources/monitoring-logstash-mb.json (for metricbeat collection).

@matschaffer
Copy link
Contributor

Update: I found a cgroup v1 setup I can use and got basic reporting via logstash & metricbeat going. Seeing if I can get the ES templates updated. I'll open a master issue to track the stack monitoring bug (separate from the lack of cgroup v2 support on logtash).

Copy link
Contributor

@matschaffer matschaffer left a comment

Choose a reason for hiding this comment

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

This works for me. It wasn't clear to me what was causing the github actions to fail, but I've updated the branch. If it passes, I'll merge it.

I'll keep the issue open until both this and the corresponding mapping change in ES are done.

Thanks for the contribution! 🧡

@matschaffer matschaffer self-assigned this Sep 29, 2022
@matschaffer
Copy link
Contributor

Guessing it's the lint checks making it looks like I need to make update. I'll work on satisfying those tomorrow before merge.

@matschaffer matschaffer merged commit 543e1f2 into elastic:main Sep 30, 2022
mergify bot pushed a commit that referenced this pull request Sep 30, 2022
* fix logstash cgroup mapping

* ran make update and added changed files

- docs/fields.asciidoc
- module/logstash/fields.go

* Add changelog entry

* lint

Co-authored-by: Mat Schaffer <[email protected]>
(cherry picked from commit 543e1f2)
matschaffer pushed a commit that referenced this pull request Sep 30, 2022
* fix logstash cgroup mapping

* ran make update and added changed files

- docs/fields.asciidoc
- module/logstash/fields.go

* Add changelog entry

* lint

Co-authored-by: Mat Schaffer <[email protected]>
(cherry picked from commit 543e1f2)

Co-authored-by: Robert Paschedag <[email protected]>
chrisberkhout pushed a commit that referenced this pull request Jun 1, 2023
* fix logstash cgroup mapping

* ran make update and added changed files

- docs/fields.asciidoc
- module/logstash/fields.go

* Add changelog entry

* lint

Co-authored-by: Mat Schaffer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.5.0 Automated backport with mergify Team:Infra Monitoring UI - DEPRECATED Infrastructure Monitoring UI team - DEPRECATED - Use Team:Monitoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants