I want to have a shared app insights instance that will hold all logs from different microservices running.
For each of them I am adding
services.AddLogging(
loggingBuilder =>
{
loggingBuilder
.SetMinimumLevel(settings.LogLevel)
.AddApplicationInsights();
}
);
But then in the azure portal I want to be able to search for logs for individual applications, for example using query like "applicationName = 'MyAppName'".
Is it possible to setup loggingBuilder
to add in this custom property applicationName
to be MyAppName
?
Logging itself is done like
public void MyMethod()
{
try
{
//whatever
}
catch (Exception ex)
{
logger.LogError(ex, "Meaningful information");
}
}
Or is it a bad idea in general to share app insights instance and have all logs and telemetry available in 1 pile?