Elastic APM PHP - tracking multiple domains on same server

Kibana version: 8.8
Elasticsearch version: 8.8
APM Server version: 8.8
APM Agent language and version: PHP Agent v1.9
Original install method: deb
Fresh install or upgraded from other version?: fresh

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):
We're investigating if we can migrate from our current APM solution towards Elastic APM.
We are running multiple websites (running PHP) on the same debian webserver, running apache with separate vhosts for every domain.
I have installed the Elastic PHP APM Agent, latest version, and Elastic APM Server, latest version, on my server.
On production my plan is to use Fleet and ElasticAgent with policies for this.

The problem is that witb the current setup we can't easily distinguish between our different websites, the service name is set in the PHP .ini file and I have this set to "webshop".
But I can't find out how to set this dynamically, so we can have "webshop-domainA" and "webshop-domainB", on the same server.

The documentation says this can be configured with .ini or with env variable: Configuration reference | APM PHP Agent Reference [1.x] | Elastic
But if I add " SetEnv ELASTIC_APM_SERVICE_NAME webshop-domainA", this isn't picked up. It stays "webshop" (the .ini value).
And if I remove the .ini value, all my requests are now logged as "unknown-php-service".

Even placing this on the index.php file:

ini_set('elastic_apm.service_name', 'webshopA');
$_ENV["ELASTIC_APM_SERVICE_NAME"]    = "webshopB";

Does not seem to influence anything.
Am I missing something in my setup / config to setup the service name correctly or is this not possible with Elastic APM?

Thanks, Bram

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.