I've setup my web app to use Application Insights and I'm receiving the data in the Azure portal. I've also set up Application Insights Logging with .NET and I can now create alerts and have an action created for sending myself an email when specific conditions are triggered Ex. A new exception that I log with ILogger
_logger.LogError(new Exception(), "some message");
But now I want to create an alert with an email notification when I log warnings, debugs and information, and errors (w/ no exception).
Ex.
_logger.LogInformation("testing LogInformation");
_logger.LogWarning("testing LogWarning");
_logger.Debug("testing LogDebug");
_logger.Error("testing LogError w/ no exception");
QUESTION - When I create an alert, what signal do I use for log warnings, debug and information?
FYI - When I created the alert for exceptions I used this "exceptions" under metrics .
But I don't really see anything else in the list of all signals to use for the logging of warnings, information, etc.
WHAT I TIRED - I tried creating a alert w/ the signal name of "All Administrative Operations" and then setting the level to warning, but that didn't do anything when I created a log warning server side.
There isn't a specific signal type for this kind of logging. It ends up as an entry in the traces
table in Application Insights. However, there is the Custom log search
that you can use. It allows you to define a kusto query and create an alert:
The severitylevel indicates whether it is logged as a warning etc.
An example condition is to create an alert whenever the number of rows returned in the given period is greater dan 0: