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

Add orchestrator cluster ECS fields in k8s events #31341

Merged
merged 4 commits into from
Apr 20, 2022

Conversation

ChrsMark
Copy link
Member

@ChrsMark ChrsMark commented Apr 19, 2022

What does this PR do?

This PR adds ECS orchestrator fields for k8s events. This is not happening at the moment because events are being collected through "watchers" and the metadata generators are not applicable due to the nature of these objects. However we can directly add orchestrator metadata about the cluster.

Why is it important?

In order to be able to filter out events per cluster on Dashboards.

Closes elastic/integrations#3114

Sample ES event:

{
  "@timestamp": "2022-04-19T08:40:34.347Z",
  "@metadata": {
    "beat": "metricbeat",
    "type": "_doc",
    "version": "8.3.0"
  },
  "ecs": {
    "version": "8.0.0"
  },
  "host": {
    "name": "kind-control-plane"
  },
  "agent": {
    "type": "metricbeat",
    "version": "8.3.0",
    "ephemeral_id": "118c830a-fc6a-46f2-b99a-b7cd29d53350",
    "id": "b210221a-9944-4f3d-8920-6fa617f66a24",
    "name": "kind-control-plane"
  },
  "kubernetes": {
    "event": {
      "reason": "Pulling",
      "type": "Normal",
      "count": 1,
      "source": {
        "component": "kubelet",
        "host": "kind-control-plane"
      },
      "involved_object": {
        "uid": "46c9d822-5415-49e5-8c1f-cfcb8e110ec2",
        "api_version": "v1",
        "resource_version": "353488",
        "name": "busybox",
        "kind": "Pod"
      },
      "metadata": {
        "resource_version": "353495",
        "timestamp": {
          "created": "2022-04-19T08:40:34.000Z"
        },
        "name": "busybox.16e73f86433fba9c",
        "namespace": "default",
        "self_link": "",
        "generate_name": "",
        "uid": "ea38e90c-c262-4e74-ac72-af6b6844605f"
      },
      "timestamp": {
        "first_occurrence": "2022-04-19T08:40:34.000Z",
        "last_occurrence": "2022-04-19T08:40:34.000Z"
      },
      "message": "Pulling image \"busybox:1.28\""
    }
  },
  "orchestrator": {
    "cluster": {
      "url": "kind-control-plane:6443",
      "name": "kind"
    }
  },
  "metricset": {
    "name": "event"
  },
  "event": {
    "dataset": "kubernetes.event",
    "module": "kubernetes"
  },
  "service": {
    "type": "kubernetes"
  }
}

@ChrsMark ChrsMark added v8.3.0 backport-v8.3.0 Automated backport with mergify labels Apr 19, 2022
@ChrsMark ChrsMark requested review from MichaelKatsoulis and a team April 19, 2022 08:46
@ChrsMark ChrsMark self-assigned this Apr 19, 2022
@ChrsMark ChrsMark requested a review from a team as a code owner April 19, 2022 08:46
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Apr 19, 2022
@botelastic
Copy link

botelastic bot commented Apr 19, 2022

This pull request doesn't have a Team:<team> label.

Signed-off-by: chrismark <[email protected]>
@ChrsMark ChrsMark requested a review from a team as a code owner April 19, 2022 08:54
@ChrsMark ChrsMark requested review from belimawr and faec and removed request for a team April 19, 2022 08:54
@elasticmachine
Copy link
Collaborator

elasticmachine commented Apr 19, 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-04-19T10:27:52.556+0000

  • Duration: 52 min 48 sec

Test stats 🧪

Test Results
Failed 0
Passed 3533
Skipped 877
Total 4410

💚 Flaky test report

Tests succeeded.

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

Signed-off-by: chrismark <[email protected]>
Signed-off-by: chrismark <[email protected]>
Copy link
Contributor

@tetianakravchenko tetianakravchenko left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@MichaelKatsoulis MichaelKatsoulis left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.3.0 Automated backport with mergify needs_team Indicates that the issue/PR needs a Team:* label v8.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Collect metadata for k8s events
5 participants