Override agent.name, or add custom fields to fleet managed agents?


currently I deploy the *beats with salt, and in the beats config file, I use to set the
That name: field then in Elasticsearch/kibana shows up as the agent.name in the indices.

This allows me easily to find logs of a given salt minion id in Kibana, searching for agent.name:

also what I use to configure the *beats is the fields:
so in the *beats yml file I've something alike:
servicename: foo

as multiple hosts may be part of a system/service, that way I can easily search for all logs of a given service from all hosts that are part of it.
I'm aware that I could set the "environment" for the agent, but that wouldn't really match what I want.

I don't seem to find anything, if it is possible to specify agent specific values or override the agent's name.
I.e. the *beats have the -E command line parameter to override configurations that might be in the config file.
Currently there doesn't seem to exist something like this but would be nice to have something similar for the agent when it enrolls into fleet, i.e:

elastic-agent install .... -E name: foo -E fields.servicename: bar ....

and then it would add these custom values to it's agents config and forward them to ES.

Or if using the agent in standalone mode, is it possible to set the the agent.name and add such custom metadata like for the fields.servicename ?


We don't support this yet but it is a request we have seen a few times. @Nima_Rezainia Do we have by chance already an issue for this that we could link here?


thanks for this request for enhancement. We have been asked to provide a tagging mechanism from the install command line. [Agent] Setting Tags/labels at enrolment and installation · Issue #27712 · elastic/beats · GitHub

i will add the name change as an option to override also to this request.


Thanks @ruflin and @Nima_Rezainia for picking this up, I subscribed to the github issue to follow it there.
being able to give a custom value to the agent.name would greatly help, esp. for the case where not only the elastic-agent is on a host, but also other *beats may be there at the same time.