Reputation: 2290
We've deployed Azure Functions on Linux to an Azure Container Instance.
Unfortunately, the application insights logging is not displaying my cloud_RoleName
at all using the default ILogger
. In order to query logs by container, I need to set the cloud_RoleName
to the name of the container image.
How can I set this telemetry property without having to use the Telemetry Client directly?
Upvotes: 2
Views: 652
Reputation: 2290
As stated in kudu we managed to set the cloud_RoleName
property by adding this environment variable to our ARM template in the Microsoft.ContainerInstance/containerGroups
section in the ContainerProperties EnvironmentVariable array:
{
"name": "WEBSITE_SITE_NAME",
"value": "[parameters('containerGroups_name')]"
}
Now the logs in AppInsights contain the value set in the WEBSITE_SITE_NAME
variable and we can easily query our logs as follows:
traces | where cloud_RoleName == "containerName"
This might also work for the cloud_RoleInstance
by setting the WEBSITE_INSTANCE_ID
environment variable.
Upvotes: 3