I have my first App Service website in Azure running a Blazor Server app. I’m sending the logs to Application Insights, however, I wanted to see if there is a way that I can only capture logs that would come from the application code and not all the system logs.
I would also be okay if I had to log everything if there is a way that I can narrow down only User logs in my KQL query.
I have Function Apps that I’m logging more than just my user coded logs but I’m able to use the following in my KQL to only pull logs that were created from within the code. Unfortunately, it doesn’t look like the logs from an App Service have the Category property in the Custom Dimensions.
| where customDimensions["Category"] has "User"
Here is what I have in my appsettings for logging.
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
},
"ApplicationInsights": {
"LogLevel": {
"Default": "Information"
}
}
},
"ApplicationInsights": {
"ConnectionString": "connctionstring info”
}
Creating logs by injecting the ILooger on the Razor page. Here is my Using statement and how I log.
@inject ILogger<Index> _log
_log.LogInformation("Initializing Index page.");