elastic / elastic-agent

Elastic Agent - single, unified way to add monitoring for logs, metrics, and other types of data to a host.
Other
124 stars 134 forks source link

[Elastic Agent] Provide the ability for the user to set the name of their agent during installation #86

Open nimarezainia opened 2 years ago

nimarezainia commented 2 years ago

Use Case: Currently the name attached to the agent is chosen by Elastic - as in derived from some other entity (i.e machine name). Often these names have no significance to the user of our product who many need to better visually differentiate. In some instances the user is operating a multi tenanted environment and would like to encode the tenant name/ID into the agent name.

Proposal: Provide a flag for the user to overwrite the given name during installation/enrollment. This name should appear in the Fleet UI.

Suggested syntax:

elastic-agent enroll --url=https:// --enrollment-token= --name=”CEO laptop”

elastic-agent install --url=https:// --enrollment-token= --name=”CEO laptop”

jlind23 commented 2 years ago

@nimarezainia Where should this name be stored?

elasticmachine commented 2 years ago

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

ruflin commented 2 years ago

Should a user also be able to change this name in Fleet through the UI / API?

nimarezainia commented 2 years ago

@jlind23 stored in the fleet, where today we use the machine name.

@ruflin What other attributes of the agent can be set via UI/API? aside from namespace not sure much can be changed. original intention of this for the name to be defined during installation where there is context. Ability to change the name via UI does make sense. I will add that.

ruflin commented 2 years ago

I don't think we have other properties yet that can be changed.

@joshdover AFAIK we already have a saved object per agent where this could be stored. Lets make sure if we also add support for tags we have a "generic" implementation meaning at least the API calls are consistent to update properties of an Elastic Agent. Where is the log level of an Elastic Agent stored?

joshdover commented 2 years ago

AFAIK we already have a saved object per agent where this could be stored. Lets make sure if we also add support for tags we have a "generic" implementation meaning at least the API calls are consistent to update properties of an Elastic Agent.

Correction: we no longer have a Saved Object for Agents but we do have a document in the .fleet-agents index, but the same idea applies. +1 on supporting updates to this via the PUT /api/fleet/agents/:id endpoint in Kibana.

jlind23 commented 2 years ago

For further conversation:

ph commented 2 years ago

This is similar to what we have done for tags, I'd suggest we allow a user to specify the name at enroll time this would align well with provisioning tool like jamf. If we want to add the possibility to change the name of a machine we should only allow that changes to happen on fleet.

Tasks:

asazallesmilner commented 1 year ago

We are having the same issue. We urgently need a way to override the hostname that is being provided by the server to elastic agent to enable connectivity. Is there any way to do that? related to support ticket 01333744

rubal033 commented 1 year ago

I think this will solve below problem as well: https://discuss.elastic.co/t/grouping-hosts-in-infrastructure-by-custom-key-or-tags/336707

It would be good if we can use the fleet tags in infrastructure and other observability filters.

intxgo commented 2 months ago

Hi, as I mentioned on the ER, [Defend] is also affected

if it's implemented this custom name should also be passed to Endpoint via policy, see external issue