Open ejizba opened 11 months ago
+1
Adding @trask for help on configuring the agent using applicationinsight.json
file.
@heyams was helping me troubleshoot this. The config file won't work for the agent, and it seems the only way to enable this through the environment variable APPLICATIONINSIGHTS_CONFIGURATION_CONTENT. Another option is to use workspace transformation to filter out logs. https://learn.microsoft.com/en-us/azure/azure-monitor/logs/tutorial-workspace-transformations-portal#:~:text=the%20audit%20log.-,Add%20a%20transformation%20to%20the%20table,-Now%20that%20the
I tried using APPLICATIONINSIGHTS_CONFIGURATION_CONTENT
but the cloud role name in the logs is still the function app name rather than myapp
so I'm doubting that it actually takes effect, it seems like it is still host.json
that controls the logging even though the documentation says it will bypass the host when enabling the insights agent.
{
"connectionString": "${APPLICATIONINSIGHTS_CONNECTION_STRING}",
"role": {
"name": "myapp"
},
"sampling": {
"percentage": 100,
"overrides": [
{
"telemetryType": "dependency",
"percentage": 3
}
]
},
"instrumentation": {
"logging": {
"level": "DEBUG"
}
}
}
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"initialSamplingPercentage": 3.0,
"minSamplingPercentage": 1.0,
"maxSamplingPercentage": 3.0,
"includedTypes": "Dependency"
}
}
}
}
{
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
value: appInsightsConnectionString
}
{
name: 'APPLICATIONINSIGHTS_ENABLE_AGENT'
value: 'true'
}
{
name: 'APPLICATIONINSIGHTS_CONFIGURATION_CONTENT'
value: loadTextContent('../applicationinsights.json')
}
When using the app insights java agent, the only known way to configure log levels is by using sampling overrides as described in these docs. However, it's not possible to add an "applicationinsights.json" file next to the agent jar file because it's stored/shipped with the worker, not the app.
Related IcM (internal link only)