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

[Fleet] Provide license info in telemetry #182150

Conversation

jillguyonnet
Copy link
Contributor

@jillguyonnet jillguyonnet commented Apr 30, 2024

Summary

Relates https://github.com/elastic/ingest-dev/issues/2866

This PR adds license information to Fleet telemetry events stored in the fleet-usages* index. The license. issued_to field provides the customer name.

Testing locally

In a local setup, only the new license_issued_to field is defined.

Fleet usage logger:

  1. Change the interval of the FleetUsageLogger to e.g. 1m.
  2. Wait for the log line to show up:
Fleet Usage: {"agents_enabled":true,"agents":{"total_enrolled":3,"healthy":3,"unhealthy":0,"offline":0,"inactive":0,"unenrolled":0,"total_all_statuses":3,"updating":0},"fleet_server":{"total_enrolled":1,"healthy":1,"unhealthy":0,"offline":0,"updating":0,"total_all_statuses":1,"num_host_urls":1},"license_issued_to":"elasticsearch"}

Fleet usage sender:

  1. Change the interval of the FleetUsageSender to e.g. 1m.
  2. Wait for the following log line:
[2024-05-03T15:24:11.843+02:00][DEBUG][plugins.fleet] Fleet usage telemetry: {"agents_enabled":true,"agents":{"total_enrolled":3,"healthy":3,"unhealthy":0,"offline":0,"inactive":0,"unenrolled":0,"total_all_statuses":3,"updating":0},"fleet_server":{"total_enrolled":1,"healthy":1,"unhealthy":0,"offline":0,"updating":0,"total_all_statuses":1,"num_host_urls":1},"packages":[{"name":"system","version":"1.55.2","enabled":true},{"name":"synthetics","version":"1.2.1","enabled":false},{"name":"fleet_server","version":"1.5.0","enabled":true},{"name":"elastic_agent","version":"1.18.0","enabled":false},{"name":"nginx","version":"1.20.0","enabled":false}],"agent_checkin_status":{"error":0,"degraded":0},"agents_per_policy":[2,1],"agents_per_os":[{"name":"Ubuntu","version":"20.04.6 LTS (Focal Fossa)","count":3}],"fleet_server_config":{"policies":[{"input_config":{}}]},"agent_policies":{"count":3,"output_types":["elasticsearch"]},"agent_logs_panics_last_hour":[],"agent_logs_top_errors":[],"fleet_server_logs_top_errors":[],"license_issued_to":"elasticsearch"}

Upgrade sender:

  1. Change the interval of the FleetUsageSender to e.g. 1m.
  2. (Re)install a package and wait for the telemetry log (DEBUG level), which should contain license information:
[2024-05-03T15:20:41.087+02:00][DEBUG][plugins.fleet.telemetry_events] [{"packageName":"nginx","currentVersion":"1.20.0","newVersion":"1.20.0","status":"success","dryRun":false,"eventType":"package-install","installType":"reinstall","errorMessage":[],"license_issued_to":"elasticsearch"}]

Checklist

@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@jillguyonnet jillguyonnet self-assigned this Apr 30, 2024
@jillguyonnet jillguyonnet added Team:Fleet Team label for Observability Data Collection Fleet team backport:skip This commit does not require backporting labels Apr 30, 2024
@jillguyonnet
Copy link
Contributor Author

/ci

@jillguyonnet
Copy link
Contributor Author

@elasticmachine merge upstream

@jillguyonnet
Copy link
Contributor Author

/ci

@jillguyonnet
Copy link
Contributor Author

@elasticmachine merge upstream

@jillguyonnet jillguyonnet marked this pull request as ready for review May 1, 2024 13:06
@jillguyonnet jillguyonnet requested a review from a team as a code owner May 1, 2024 13:06
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@jillguyonnet jillguyonnet added the release_note:skip Skip the PR/issue when compiling release notes label May 1, 2024

await this.send(
events,
eventsWithLicenseInfo,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this sender is only used for sending upgrade events, we should probably add the license info to FleetUsageSender too.
You can see that logged as

[2024-05-01T15:13:14.420+02:00][DEBUG][plugins.fleet] Fleet Usage: {"agents_enabled":true,"agents":{"total_enrolled":1,"healthy":0,"unhealthy":0,"offline":1,"inactive":0,"unenrolled":2,"total_all_statuses":3,"updating":0},"fleet_server":{"total_enrolled":1,"healthy":0,"unhealthy":0,"offline":1,"updating":0,"total_all_statuses":1,"num_host_urls":1}}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey, can I ask for a clarification?

Is it correct that the FleetUsageSender sends telemetry data through e.g.

core.analytics.reportEvent(FLEET_USAGES_EVENT_TYPE, fleetUsageData);

Just wondering, as the TelemetryEventsSender uses a simple POST request to the telemetry URL.

Edit: think I answered my own question, will push change :)

@juliaElastic
Copy link
Contributor

Is it possible to add “Organization ID” and “Deployment ID” too as requested here? https://github.com/elastic/ingest-dev/issues/2866#issuecomment-2014029639

@jillguyonnet
Copy link
Contributor Author

Is it possible to add “Organization ID” and “Deployment ID” too as requested here? https://github.com/elastic/ingest-dev/issues/2866#issuecomment-2014029639

Hey @juliaElastic I've been struggling to get those via the internal clients, know if I might be missing anything? I've provisionally added the cluster info to the usage sender.

Also, I've checked for 3 things as detailed in the description (fleet usage sender, fleet usage logger, upgrade sender). I'm puzzled why changing the interval in FleetUsageSender doesn't seem to affect the actual running of the task though. Do you know what I'm doing wrong?

@juliaElastic
Copy link
Contributor

juliaElastic commented May 3, 2024

I've been struggling to get those via the internal clients, know if I might be missing anything? I've provisionally added the cluster info to the usage sender.

I'll take a look.

I'm puzzled why changing the interval in FleetUsageSender doesn't seem to affect the actual running of the task though. Do you know what I'm doing wrong?

I think you have to increase the task version to let kibana pick up the change:

When I'm running your pr locally, I'm seeing cluster_info and license_info logged out, you could test in cloud by adding the ci:cloud-deploy label, to see what is there. Locally I don't see org id or deployment id.

[2024-05-03T13:38:15.602+02:00][DEBUG][plugins.fleet] Fleet usage telemetry: {"agents_enabled":true,"agents":{"total_enrolled":10,"healthy":2,"unhealthy":0,"offline":8,"inactive":0,"unenrolled":0,"total_all_statuses":10,"updating":0},"fleet_server":{"total_enrolled":7,"healthy":1,"unhealthy":0,"offline":6,"updating":0,"total_all_statuses":7,"num_host_urls":1},"packages":[{"name":"synthetics","version":"1.2.1","enabled":false},{"name":"system","version":"1.55.2","enabled":true},{"name":"fleet_server","version":"1.5.0","enabled":true},{"name":"apm","version":"8.13.0-SNAPSHOT","enabled":false},{"name":"elastic_agent","version":"1.19.0","enabled":false}],"agent_checkin_status":{"error":1,"degraded":0},"agents_per_policy":[7,3],"agents_per_os":[{"name":"macOS","version":"14.4.1","count":8},{"name":"Ubuntu","version":"20.04.6 LTS (Focal Fossa)","count":2}],"fleet_server_config":{"policies":[{"input_config":{}}]},"agent_policies":{"count":2,"output_types":["elasticsearch"]},"agent_logs_panics_last_hour":[],"agent_logs_top_errors":[],"fleet_server_logs_top_errors":[],"license_info":{"license":{"status":"active","uid":"15bf348c-01e9-40eb-9037-3e170b73d961","type":"trial","issue_date":"2024-05-02T08:39:17.624Z","issue_date_in_millis":1714639157624,"expiry_date":"2024-06-01T08:39:17.624Z","expiry_date_in_millis":1717231157624,"max_nodes":1000,"max_resource_units":null,"issued_to":"elasticsearch","issuer":"elasticsearch","start_date_in_millis":-1}},"cluster_info":{"name":"Julias-MacBook-Pro.local","cluster_name":"elasticsearch","cluster_uuid":"gn-gw9hdRp-PJzyECDL0Vg","version":{"number":"8.15.0-SNAPSHOT","build_flavor":"default","build_type":"tar","build_hash":"3e6df2630e40f0083b4ac68bbd932de2ce7e272f","build_date":"2024-04-25T13:05:24.400349590Z","build_snapshot":true,"lucene_version":"9.10.0","minimum_wire_compatibility_version":"7.17.0","minimum_index_compatibility_version":"7.0.0"},"tagline":"You Know, for Search"}}
[2024-05-03T13:38:15.603+02:00][ERROR][plugins.fleet] Error occurred while sending Fleet Usage telemetry: Error: Failed to validate payload coming from "Event Type 'fleet_usage'":
        - []: excess key 'license_info' found
        - []: excess key 'cluster_info' found

You also have to add new fields to the fleet_usages_schema.ts

@juliaElastic juliaElastic added the ci:cloud-deploy Create or update a Cloud deployment label May 3, 2024
@jillguyonnet
Copy link
Contributor Author

I think you have to increase the task version to let kibana pick up the change:

Thank you, it works! Should we increase the version for this change?

@juliaElastic
Copy link
Contributor

I think you have to increase the task version to let kibana pick up the change:

Thank you, it works! Should we increase the version for this change?

Yes.

@juliaElastic
Copy link
Contributor

juliaElastic commented May 3, 2024

I found a way to add deploymentId to telemetry by using the cloud plugin like here:

const cloudSetup = appContextService.getCloud();
if (
cloudSetup &&
!cloudSetup.isServerlessEnabled &&
cloudSetup.isCloudEnabled &&
cloudSetup.cloudHost
) {
// Fleet Server url are formed like this `https://<deploymentId>.fleet.<host>
return [
`https://${cloudSetup.deploymentId}.fleet.${cloudSetup.cloudHost}${

I didn't find organization id anywhere in kibana code.

I think we probably don't need cluster_info fields, and from licence_info it might be enough to send issued_to, to add only fields that will be used, @nimarezainia can confirm.

example
 "license_info": {
        "license": {
            "status": "active",
            "uid": "15bf348c-01e9-40eb-9037-3e170b73d961",
            "type": "trial",
            "issue_date": "2024-05-02T08:39:17.624Z",
            "issue_date_in_millis": 1714639157624,
            "expiry_date": "2024-06-01T08:39:17.624Z",
            "expiry_date_in_millis": 1717231157624,
            "max_nodes": 1000,
            "max_resource_units": null,
            "issued_to": "elasticsearch",
            "issuer": "elasticsearch",
            "start_date_in_millis": -1
        }
    },
    "cluster_info": {
        "name": "Julias-MacBook-Pro.local",
        "cluster_name": "elasticsearch",
        "cluster_uuid": "gn-gw9hdRp-PJzyECDL0Vg",
        "version": {
            "number": "8.15.0-SNAPSHOT",
            "build_flavor": "default",
            "build_type": "tar",
            "build_hash": "3e6df2630e40f0083b4ac68bbd932de2ce7e272f",
            "build_date": "2024-04-25T13:05:24.400349590Z",
            "build_snapshot": true,
            "lucene_version": "9.10.0",
            "minimum_wire_compatibility_version": "7.17.0",
            "minimum_index_compatibility_version": "7.0.0"
        },
        "tagline": "You Know, for Search"
    }

There are a few more fields in this CloudSetup type that might be useful, e.g. isElasticStaffOwned and serverless.projectId.

@jillguyonnet
Copy link
Contributor Author

@elasticmachine merge upstream

@nimarezainia
Copy link
Contributor

I found a way to add deploymentId to telemetry by using the cloud plugin like here:

const cloudSetup = appContextService.getCloud();
if (
cloudSetup &&
!cloudSetup.isServerlessEnabled &&
cloudSetup.isCloudEnabled &&
cloudSetup.cloudHost
) {
// Fleet Server url are formed like this `https://<deploymentId>.fleet.<host>
return [
`https://${cloudSetup.deploymentId}.fleet.${cloudSetup.cloudHost}${

I didn't find organization id anywhere in kibana code.

I think we probably don't need cluster_info fields, and from licence_info it might be enough to send issued_to, to add only fields that will be used, @nimarezainia can confirm.
example

 "license_info": {
        "license": {
            "status": "active",
            "uid": "15bf348c-01e9-40eb-9037-3e170b73d961",
            "type": "trial",
            "issue_date": "2024-05-02T08:39:17.624Z",
            "issue_date_in_millis": 1714639157624,
            "expiry_date": "2024-06-01T08:39:17.624Z",
            "expiry_date_in_millis": 1717231157624,
            "max_nodes": 1000,
            "max_resource_units": null,
            "issued_to": "elasticsearch",
            "issuer": "elasticsearch",
            "start_date_in_millis": -1
        }
    },
    "cluster_info": {
        "name": "Julias-MacBook-Pro.local",
        "cluster_name": "elasticsearch",
        "cluster_uuid": "gn-gw9hdRp-PJzyECDL0Vg",
        "version": {
            "number": "8.15.0-SNAPSHOT",
            "build_flavor": "default",
            "build_type": "tar",
            "build_hash": "3e6df2630e40f0083b4ac68bbd932de2ce7e272f",
            "build_date": "2024-04-25T13:05:24.400349590Z",
            "build_snapshot": true,
            "lucene_version": "9.10.0",
            "minimum_wire_compatibility_version": "7.17.0",
            "minimum_index_compatibility_version": "7.0.0"
        },
        "tagline": "You Know, for Search"
    }

There are a few more fields in this CloudSetup type that might be useful, e.g. isElasticStaffOwned and serverless.projectId.

thank you @jillguyonnet and @juliaElastic for your efforts on this.
The main goal of that issue is so that we are able to identify the end customer.

If deploymentID is available in the telemetry, for ESs customers, the only way I know how to get to the cluster is by looking up the deploymentID via admin.found.no.
If we have the clusterID, the same mechanism is generally successful in mapping.
Both will yield a cluster and we can navigate and find who owns the cluster.

License issued to (I think already exists in our telemetry) is less reliable unfortunately. It may resolve to "cloud" in cases where the license was issued via API (which seems often).

I will follow up over email with some other information that may help.

@jillguyonnet
Copy link
Contributor Author

@nimarezainia In the context of the recent discussions, would there be any value in adding any of the already available fields? e.g. deployment_id, license.issued_to or any of the ones from license_info and cluster_info as listed in #182150 (comment). If not, I will close this PR to allow focus on the longer term solution.

@nimarezainia
Copy link
Contributor

@nimarezainia In the context of the recent discussions, would there be any value in adding any of the already available fields? e.g. deployment_id, license.issued_to or any of the ones from license_info and cluster_info as listed in #182150 (comment). If not, I will close this PR to allow focus on the longer term solution.

Yes please add those and we can perhaps call this issue closed for now. I believe that the deploymentID in particular at least would give us the opportunity to correctly identify the user/customer and take it from there. Thanks you again.

@jillguyonnet
Copy link
Contributor Author

@elasticmachine merge upstream

@jillguyonnet
Copy link
Contributor Author

Tested this on a cloud deployment:

Fleet Usage: {"agents_enabled":true,"agents":{"total_enrolled":2,"healthy":1,"unhealthy":0,"offline":1,"inactive":0,"unenrolled":0,"total_all_statuses":2,"updating":0},"fleet_server":{"total_enrolled":2,"healthy":1,"unhealthy":0,"offline":1,"updating":0,"total_all_statuses":2,"num_host_urls":1},"license_issued_to":"5abb01410b1a483e8bf3fa42bcd9e78c","deployment_id":"d91086e05fdb50ff76f6e2be522f539d"}

and from a package install:

[{"packageName":"elastic_agent","currentVersion":"not_installed","newVersion":"1.19.0","status":"success","dryRun":false,"eventType":"package-install","installType":"install","errorMessage":[],"license_issued_to":"5abb01410b1a483e8bf3fa42bcd9e78c","deployment_id":"d91086e05fdb50ff76f6e2be522f539d"}]

Does license.issued_to look right? @nimarezainia

@nimarezainia
Copy link
Contributor

Tested this on a cloud deployment:

Fleet Usage: {"agents_enabled":true,"agents":{"total_enrolled":2,"healthy":1,"unhealthy":0,"offline":1,"inactive":0,"unenrolled":0,"total_all_statuses":2,"updating":0},"fleet_server":{"total_enrolled":2,"healthy":1,"unhealthy":0,"offline":1,"updating":0,"total_all_statuses":2,"num_host_urls":1},"license_issued_to":"5abb01410b1a483e8bf3fa42bcd9e78c","deployment_id":"d91086e05fdb50ff76f6e2be522f539d"}

and from a package install:

[{"packageName":"elastic_agent","currentVersion":"not_installed","newVersion":"1.19.0","status":"success","dryRun":false,"eventType":"package-install","installType":"install","errorMessage":[],"license_issued_to":"5abb01410b1a483e8bf3fa42bcd9e78c","deployment_id":"d91086e05fdb50ff76f6e2be522f539d"}]

Does license.issued_to look right? @nimarezainia

@jillguyonnet the deploymentID maps to cluster: kibana-pr-182150 does this sound right to you?
Unfortunately the license_issued_to. is not yielding anything from the licensing portal nor salesforce.

@jlind23 I'm wondering if you see it differently.

@jlind23
Copy link
Contributor

jlind23 commented May 14, 2024

@nimarezainia I found the same result. FWIW it is an internal deployment and a non paying organization under a trial status so it might explain why the license portal does not yield any result.

@jillguyonnet
Copy link
Contributor Author

@nimarezainia kibana-pr-182150 is correct 👍 @jlind23 made a good point about the license. Shall we keep both then?

@jlind23
Copy link
Contributor

jlind23 commented May 14, 2024

Shall we keep both then?

From my perspective, yes.

@jillguyonnet jillguyonnet removed the ci:cloud-deploy Create or update a Cloud deployment label May 15, 2024
@jillguyonnet
Copy link
Contributor Author

@elasticmachine merge upstream

@jlind23 jlind23 requested a review from juliaElastic May 15, 2024 09:32
@@ -61,6 +63,8 @@ export const fetchFleetUsage = async (
...(await getPanicLogsLastHour(esClient)),
...(await getAgentLogsTopErrors(esClient)),
agents_per_output_type: await getAgentsPerOutput(soClient, esClient),
license_issued_to: (await esClient.license.get()).license.issued_to,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: would it make sense to use the same fetchLicenseInfo function to get the license info and catch errors?

Copy link
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

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

LGTM

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @jillguyonnet

@jillguyonnet jillguyonnet merged commit 755a37d into elastic:main May 15, 2024
22 checks passed
@jillguyonnet jillguyonnet deleted the fleet/2866-provide-customer-name-in-telemetry branch May 15, 2024 13:05
@jen-huang
Copy link
Contributor

@jillguyonnet I want to backport #184056 to 8.14 branch so I'm going to backport this one first to avoid conflicts. The more telemetry the better :)

@jen-huang jen-huang added v8.14.0 backport:prev-minor Backport to the previous minor version (i.e. one version back from main) and removed backport:skip This commit does not require backporting labels May 23, 2024
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 23, 2024
### Summary

Relates elastic/ingest-dev#2866

This PR adds license information to Fleet telemetry events stored in the
`fleet-usages*` index. The `license. issued_to` field provides the
customer name.

### Testing locally

In a local setup, only the new `license_issued_to` field is defined.

Fleet usage logger:
1. Change the
[interval](https://github.com/elastic/kibana/blob/de755234957b8df5bb773587150014b076fe5551/x-pack/plugins/fleet/server/services/fleet_usage_logger.ts#L59C46-L59C48)
of the `FleetUsageLogger` to e.g. `1m`.
2. Wait for the log line to show up:
```
Fleet Usage: {"agents_enabled":true,"agents":{"total_enrolled":3,"healthy":3,"unhealthy":0,"offline":0,"inactive":0,"unenrolled":0,"total_all_statuses":3,"updating":0},"fleet_server":{"total_enrolled":1,"healthy":1,"unhealthy":0,"offline":0,"updating":0,"total_all_statuses":1,"num_host_urls":1},"license_issued_to":"elasticsearch"}
```

Fleet usage sender:
1. Change the interval of the `FleetUsageSender` to e.g. `1m`.
2. Wait for the following log line:
```
[2024-05-03T15:24:11.843+02:00][DEBUG][plugins.fleet] Fleet usage telemetry: {"agents_enabled":true,"agents":{"total_enrolled":3,"healthy":3,"unhealthy":0,"offline":0,"inactive":0,"unenrolled":0,"total_all_statuses":3,"updating":0},"fleet_server":{"total_enrolled":1,"healthy":1,"unhealthy":0,"offline":0,"updating":0,"total_all_statuses":1,"num_host_urls":1},"packages":[{"name":"system","version":"1.55.2","enabled":true},{"name":"synthetics","version":"1.2.1","enabled":false},{"name":"fleet_server","version":"1.5.0","enabled":true},{"name":"elastic_agent","version":"1.18.0","enabled":false},{"name":"nginx","version":"1.20.0","enabled":false}],"agent_checkin_status":{"error":0,"degraded":0},"agents_per_policy":[2,1],"agents_per_os":[{"name":"Ubuntu","version":"20.04.6 LTS (Focal Fossa)","count":3}],"fleet_server_config":{"policies":[{"input_config":{}}]},"agent_policies":{"count":3,"output_types":["elasticsearch"]},"agent_logs_panics_last_hour":[],"agent_logs_top_errors":[],"fleet_server_logs_top_errors":[],"license_issued_to":"elasticsearch"}
```

Upgrade sender:
1. Change the
[interval](https://github.com/elastic/kibana/blob/b8d8c737e6cc7889c19a6e7984d618bf378ee617/x-pack/plugins/fleet/server/services/telemetry/fleet_usage_sender.ts#L30)
of the `FleetUsageSender` to e.g. `1m`.
4. (Re)install a package and wait for the telemetry log (DEBUG level),
which should contain license information:
```
[2024-05-03T15:20:41.087+02:00][DEBUG][plugins.fleet.telemetry_events] [{"packageName":"nginx","currentVersion":"1.20.0","newVersion":"1.20.0","status":"success","dryRun":false,"eventType":"package-install","installType":"reinstall","errorMessage":[],"license_issued_to":"elasticsearch"}]
```

### Checklist

- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
(cherry picked from commit 755a37d)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.14

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request May 23, 2024
# Backport

This will backport the following commits from `main` to `8.14`:
- [[Fleet] Provide license info in telemetry
(#182150)](#182150)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Jill
Guyonnet","email":"jill.guyonnet@elastic.co"},"sourceCommit":{"committedDate":"2024-05-15T13:05:39Z","message":"[Fleet]
Provide license info in telemetry (#182150)\n\n###
Summary\r\n\r\nRelates
elastic/ingest-dev#2866 PR adds
license information to Fleet telemetry events stored in
the\r\n`fleet-usages*` index. The `license. issued_to` field provides
the\r\ncustomer name.\r\n\r\n### Testing locally\r\n\r\nIn a local
setup, only the new `license_issued_to` field is defined.\r\n\r\nFleet
usage logger:\r\n1. Change
the\r\n[interval](https://github.com/elastic/kibana/blob/de755234957b8df5bb773587150014b076fe5551/x-pack/plugins/fleet/server/services/fleet_usage_logger.ts#L59C46-L59C48)\r\nof
the `FleetUsageLogger` to e.g. `1m`.\r\n2. Wait for the log line to show
up:\r\n```\r\nFleet Usage:
{\"agents_enabled\":true,\"agents\":{\"total_enrolled\":3,\"healthy\":3,\"unhealthy\":0,\"offline\":0,\"inactive\":0,\"unenrolled\":0,\"total_all_statuses\":3,\"updating\":0},\"fleet_server\":{\"total_enrolled\":1,\"healthy\":1,\"unhealthy\":0,\"offline\":0,\"updating\":0,\"total_all_statuses\":1,\"num_host_urls\":1},\"license_issued_to\":\"elasticsearch\"}\r\n```\r\n\r\nFleet
usage sender:\r\n1. Change the interval of the `FleetUsageSender` to
e.g. `1m`.\r\n2. Wait for the following log
line:\r\n```\r\n[2024-05-03T15:24:11.843+02:00][DEBUG][plugins.fleet]
Fleet usage telemetry:
{\"agents_enabled\":true,\"agents\":{\"total_enrolled\":3,\"healthy\":3,\"unhealthy\":0,\"offline\":0,\"inactive\":0,\"unenrolled\":0,\"total_all_statuses\":3,\"updating\":0},\"fleet_server\":{\"total_enrolled\":1,\"healthy\":1,\"unhealthy\":0,\"offline\":0,\"updating\":0,\"total_all_statuses\":1,\"num_host_urls\":1},\"packages\":[{\"name\":\"system\",\"version\":\"1.55.2\",\"enabled\":true},{\"name\":\"synthetics\",\"version\":\"1.2.1\",\"enabled\":false},{\"name\":\"fleet_server\",\"version\":\"1.5.0\",\"enabled\":true},{\"name\":\"elastic_agent\",\"version\":\"1.18.0\",\"enabled\":false},{\"name\":\"nginx\",\"version\":\"1.20.0\",\"enabled\":false}],\"agent_checkin_status\":{\"error\":0,\"degraded\":0},\"agents_per_policy\":[2,1],\"agents_per_os\":[{\"name\":\"Ubuntu\",\"version\":\"20.04.6
LTS (Focal
Fossa)\",\"count\":3}],\"fleet_server_config\":{\"policies\":[{\"input_config\":{}}]},\"agent_policies\":{\"count\":3,\"output_types\":[\"elasticsearch\"]},\"agent_logs_panics_last_hour\":[],\"agent_logs_top_errors\":[],\"fleet_server_logs_top_errors\":[],\"license_issued_to\":\"elasticsearch\"}\r\n```\r\n\r\nUpgrade
sender:\r\n1. Change
the\r\n[interval](https://github.com/elastic/kibana/blob/b8d8c737e6cc7889c19a6e7984d618bf378ee617/x-pack/plugins/fleet/server/services/telemetry/fleet_usage_sender.ts#L30)\r\nof
the `FleetUsageSender` to e.g. `1m`.\r\n4. (Re)install a package and
wait for the telemetry log (DEBUG level),\r\nwhich should contain
license
information:\r\n```\r\n[2024-05-03T15:20:41.087+02:00][DEBUG][plugins.fleet.telemetry_events]
[{\"packageName\":\"nginx\",\"currentVersion\":\"1.20.0\",\"newVersion\":\"1.20.0\",\"status\":\"success\",\"dryRun\":false,\"eventType\":\"package-install\",\"installType\":\"reinstall\",\"errorMessage\":[],\"license_issued_to\":\"elasticsearch\"}]\r\n```\r\n\r\n###
Checklist\r\n\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Julia Bardi
<90178898+juliaElastic@users.noreply.github.com>","sha":"755a37d25e133a3189c1c349f88b562084445c59","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:prev-minor","v8.14.0","v8.15.0"],"title":"[Fleet]
Provide license info in
telemetry","number":182150,"url":"#182150
Provide license info in telemetry (#182150)\n\n###
Summary\r\n\r\nRelates
elastic/ingest-dev#2866 PR adds
license information to Fleet telemetry events stored in
the\r\n`fleet-usages*` index. The `license. issued_to` field provides
the\r\ncustomer name.\r\n\r\n### Testing locally\r\n\r\nIn a local
setup, only the new `license_issued_to` field is defined.\r\n\r\nFleet
usage logger:\r\n1. Change
the\r\n[interval](https://github.com/elastic/kibana/blob/de755234957b8df5bb773587150014b076fe5551/x-pack/plugins/fleet/server/services/fleet_usage_logger.ts#L59C46-L59C48)\r\nof
the `FleetUsageLogger` to e.g. `1m`.\r\n2. Wait for the log line to show
up:\r\n```\r\nFleet Usage:
{\"agents_enabled\":true,\"agents\":{\"total_enrolled\":3,\"healthy\":3,\"unhealthy\":0,\"offline\":0,\"inactive\":0,\"unenrolled\":0,\"total_all_statuses\":3,\"updating\":0},\"fleet_server\":{\"total_enrolled\":1,\"healthy\":1,\"unhealthy\":0,\"offline\":0,\"updating\":0,\"total_all_statuses\":1,\"num_host_urls\":1},\"license_issued_to\":\"elasticsearch\"}\r\n```\r\n\r\nFleet
usage sender:\r\n1. Change the interval of the `FleetUsageSender` to
e.g. `1m`.\r\n2. Wait for the following log
line:\r\n```\r\n[2024-05-03T15:24:11.843+02:00][DEBUG][plugins.fleet]
Fleet usage telemetry:
{\"agents_enabled\":true,\"agents\":{\"total_enrolled\":3,\"healthy\":3,\"unhealthy\":0,\"offline\":0,\"inactive\":0,\"unenrolled\":0,\"total_all_statuses\":3,\"updating\":0},\"fleet_server\":{\"total_enrolled\":1,\"healthy\":1,\"unhealthy\":0,\"offline\":0,\"updating\":0,\"total_all_statuses\":1,\"num_host_urls\":1},\"packages\":[{\"name\":\"system\",\"version\":\"1.55.2\",\"enabled\":true},{\"name\":\"synthetics\",\"version\":\"1.2.1\",\"enabled\":false},{\"name\":\"fleet_server\",\"version\":\"1.5.0\",\"enabled\":true},{\"name\":\"elastic_agent\",\"version\":\"1.18.0\",\"enabled\":false},{\"name\":\"nginx\",\"version\":\"1.20.0\",\"enabled\":false}],\"agent_checkin_status\":{\"error\":0,\"degraded\":0},\"agents_per_policy\":[2,1],\"agents_per_os\":[{\"name\":\"Ubuntu\",\"version\":\"20.04.6
LTS (Focal
Fossa)\",\"count\":3}],\"fleet_server_config\":{\"policies\":[{\"input_config\":{}}]},\"agent_policies\":{\"count\":3,\"output_types\":[\"elasticsearch\"]},\"agent_logs_panics_last_hour\":[],\"agent_logs_top_errors\":[],\"fleet_server_logs_top_errors\":[],\"license_issued_to\":\"elasticsearch\"}\r\n```\r\n\r\nUpgrade
sender:\r\n1. Change
the\r\n[interval](https://github.com/elastic/kibana/blob/b8d8c737e6cc7889c19a6e7984d618bf378ee617/x-pack/plugins/fleet/server/services/telemetry/fleet_usage_sender.ts#L30)\r\nof
the `FleetUsageSender` to e.g. `1m`.\r\n4. (Re)install a package and
wait for the telemetry log (DEBUG level),\r\nwhich should contain
license
information:\r\n```\r\n[2024-05-03T15:20:41.087+02:00][DEBUG][plugins.fleet.telemetry_events]
[{\"packageName\":\"nginx\",\"currentVersion\":\"1.20.0\",\"newVersion\":\"1.20.0\",\"status\":\"success\",\"dryRun\":false,\"eventType\":\"package-install\",\"installType\":\"reinstall\",\"errorMessage\":[],\"license_issued_to\":\"elasticsearch\"}]\r\n```\r\n\r\n###
Checklist\r\n\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Julia Bardi
<90178898+juliaElastic@users.noreply.github.com>","sha":"755a37d25e133a3189c1c349f88b562084445c59"}},"sourceBranch":"main","suggestedTargetBranches":["8.14"],"targetPullRequestStates":[{"branch":"8.14","label":"v8.14.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"#182150
Provide license info in telemetry (#182150)\n\n###
Summary\r\n\r\nRelates
elastic/ingest-dev#2866 PR adds
license information to Fleet telemetry events stored in
the\r\n`fleet-usages*` index. The `license. issued_to` field provides
the\r\ncustomer name.\r\n\r\n### Testing locally\r\n\r\nIn a local
setup, only the new `license_issued_to` field is defined.\r\n\r\nFleet
usage logger:\r\n1. Change
the\r\n[interval](https://github.com/elastic/kibana/blob/de755234957b8df5bb773587150014b076fe5551/x-pack/plugins/fleet/server/services/fleet_usage_logger.ts#L59C46-L59C48)\r\nof
the `FleetUsageLogger` to e.g. `1m`.\r\n2. Wait for the log line to show
up:\r\n```\r\nFleet Usage:
{\"agents_enabled\":true,\"agents\":{\"total_enrolled\":3,\"healthy\":3,\"unhealthy\":0,\"offline\":0,\"inactive\":0,\"unenrolled\":0,\"total_all_statuses\":3,\"updating\":0},\"fleet_server\":{\"total_enrolled\":1,\"healthy\":1,\"unhealthy\":0,\"offline\":0,\"updating\":0,\"total_all_statuses\":1,\"num_host_urls\":1},\"license_issued_to\":\"elasticsearch\"}\r\n```\r\n\r\nFleet
usage sender:\r\n1. Change the interval of the `FleetUsageSender` to
e.g. `1m`.\r\n2. Wait for the following log
line:\r\n```\r\n[2024-05-03T15:24:11.843+02:00][DEBUG][plugins.fleet]
Fleet usage telemetry:
{\"agents_enabled\":true,\"agents\":{\"total_enrolled\":3,\"healthy\":3,\"unhealthy\":0,\"offline\":0,\"inactive\":0,\"unenrolled\":0,\"total_all_statuses\":3,\"updating\":0},\"fleet_server\":{\"total_enrolled\":1,\"healthy\":1,\"unhealthy\":0,\"offline\":0,\"updating\":0,\"total_all_statuses\":1,\"num_host_urls\":1},\"packages\":[{\"name\":\"system\",\"version\":\"1.55.2\",\"enabled\":true},{\"name\":\"synthetics\",\"version\":\"1.2.1\",\"enabled\":false},{\"name\":\"fleet_server\",\"version\":\"1.5.0\",\"enabled\":true},{\"name\":\"elastic_agent\",\"version\":\"1.18.0\",\"enabled\":false},{\"name\":\"nginx\",\"version\":\"1.20.0\",\"enabled\":false}],\"agent_checkin_status\":{\"error\":0,\"degraded\":0},\"agents_per_policy\":[2,1],\"agents_per_os\":[{\"name\":\"Ubuntu\",\"version\":\"20.04.6
LTS (Focal
Fossa)\",\"count\":3}],\"fleet_server_config\":{\"policies\":[{\"input_config\":{}}]},\"agent_policies\":{\"count\":3,\"output_types\":[\"elasticsearch\"]},\"agent_logs_panics_last_hour\":[],\"agent_logs_top_errors\":[],\"fleet_server_logs_top_errors\":[],\"license_issued_to\":\"elasticsearch\"}\r\n```\r\n\r\nUpgrade
sender:\r\n1. Change
the\r\n[interval](https://github.com/elastic/kibana/blob/b8d8c737e6cc7889c19a6e7984d618bf378ee617/x-pack/plugins/fleet/server/services/telemetry/fleet_usage_sender.ts#L30)\r\nof
the `FleetUsageSender` to e.g. `1m`.\r\n4. (Re)install a package and
wait for the telemetry log (DEBUG level),\r\nwhich should contain
license
information:\r\n```\r\n[2024-05-03T15:20:41.087+02:00][DEBUG][plugins.fleet.telemetry_events]
[{\"packageName\":\"nginx\",\"currentVersion\":\"1.20.0\",\"newVersion\":\"1.20.0\",\"status\":\"success\",\"dryRun\":false,\"eventType\":\"package-install\",\"installType\":\"reinstall\",\"errorMessage\":[],\"license_issued_to\":\"elasticsearch\"}]\r\n```\r\n\r\n###
Checklist\r\n\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Julia Bardi
<90178898+juliaElastic@users.noreply.github.com>","sha":"755a37d25e133a3189c1c349f88b562084445c59"}}]}]
BACKPORT-->

Co-authored-by: Jill Guyonnet <jill.guyonnet@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to the previous minor version (i.e. one version back from main) release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.14.0 v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants