Filtering or changing user metadata with Java agent

Hi!

I am using the apm Java agent attached to a Spring application without any custom spans or transactions.
Is it possible to change or filter out the user metadata? Metadata | APM Overview [7.15] | Elastic
The user.name field get's populated automatically, but I don't want to store that value. Santize configuration is not helpful here unfortunately.

Technically you could set -Duser.name=something but the user.name is used extensively within applications as well as the agent, for example to determine the home directory and which user is running the process, so I suspect it would break things. You could post-facto sanitize the value held in the elastic database, eg regularly running a batch "anonymizing" procedure?

Thanks for the response.

In my case the user.name field seems to be populated from Spring context (and is set to the name of user with active session), the -Duser.name flag doesn't seem to have any effect on that.

The transaction API has a setUser method, but I don't think I can use it together with attached agent, right?

setUser() should work, it shouldn't matter how the agent is started

I'd recommend removing the user name with an ingest node pipeline.

See Data security | APM User Guide [7.16] | Elastic