Referencing to an environment variable for usage inside apm properties file

How do we reference to an environment variable inside file? I can't find an example here -

Is this valid for file assuming ENV_APPLICATION_US_SANTACLARA exists in the environment?


I decided to try my example above. It's invalid. Here's the error

[Attach Listener] WARN co.elastic.apm.agent.shaded.stagemonitor.configuration.ConfigurationOption - Error in /tmp/ Your service name "${ENV_APPLICATION_US_SANTACLARA}" must only contain characters from the ASCII alphabet, numbers, dashes, underscores and spaces

Since the properties file is parsed as key-value literals, this is impossible.
What you could do is set the ELASTIC_APM_SERVICE_NAME environment variable in your startup script. See related documentation.

1 Like

So add ELASTIC_APM_SERVICE_NAME to the environment variable in the startup and remove it from the properties file. Correct?
Thank you.

Correct. Set it with the value of ENV_APPLICATION_US_SANTACLARA, which means you must make sure you do that only after ENV_APPLICATION_US_SANTACLARA is set.

1 Like

It worked! Thank you so much!

1 Like

Follow up question. What's the proper way of shipping catalina.out?

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