Server attributes env var interpolation is broken
ju2wheels opened this issue · 3 comments
We upgraded from Docker image scalyr/scalyr-agent-docker-syslog:2.1.10
to scalyr/scalyr-agent-docker-syslog:2.1.27-alpine
.
We were previously setting our server attributes with a config file that looks similar to this:
{
"import_vars": ["SCALYR_DEVICE", "SCALYR_DEVICE_DOMINANCE"],
"server_attributes": {
"device": "$SCALYR_DEVICE",
"dominance":"$SCALYR_DEVICE_DOMINANCE"
}
}
With 2.1.10
, if we set env vars as following:
SCALYR_DEVICE="mydevice"
SCALYR_DEVICE_DOMINANCE="primary"
Then the server attributes on forwarded messages were correctly set as expected:
device=mydevice
dominance=primary
However, with 2.1.27-alpine
, instead what we get is this:
device=mydevice
dominance=mydevice_DOMINANCE
It appears that scalyr is having variable interpolation issues because both variables start with the same prefix. I even tried the following change to see if it would help interpolation but it ended up with the same result:
{
"import_vars": ["SCALYR_DEVICE", "SCALYR_DEVICE_DOMINANCE"],
"server_attributes": {
"device": "${SCALYR_DEVICE}",
"dominance":"${SCALYR_DEVICE_DOMINANCE}"
}
}
Thank you for bringing this to our attention and documenting your observations.
I duplicated this behavior and have raised it with our Engineering team for further investigation. I will follow up with updates as they become available.
Kindly note that this behavior will not occur if the environment variable name is unique. For example, if SCALYR_DVCE_DOMINANCE
were specified instead of SCALYR_DEVICE_DOMINANCE
, it would be interpreted correctly, as the SCALYR_DEVICE
environment variable is not matched. You may also wish to change the SCALYR_
prefix to reduce potential ambiguity, as the SCALYR_
prefix is used to define Agent specific parameters (https://app.scalyr.com/help/scalyr-agent-env-aware).
Confirming fix works for me with 2.1.32-alpine
.
Thanks,