Github repos 101
spawnmarvel/azure-functions: Testing and learning Azure functions (github.com)
Log stream
In the function app we have some options for viewing files, insights and more. Lets look at log stream.
Connect and wait abit, default log level is verbose.
Lets start with the initial.
logging.info('Python HTTP trigger function processed a request.')
Log analytics and Kusto
We can query all log statments, lets start with the initial.
# To generate custom logs, use the logging statement specific to your language. Here are sample code snippets:
logging.info('Python HTTP trigger function processed a request.')
Monitoring Azure Functions with Azure Monitor Logs | Microsoft Learn
On the function app
Add diagnostics and pint it to the correct storage account
Querying the logs
Wait 5-10 min to be sure that it is ready.
When it is ready you should see functionapplogs
Browse the logs, when they are ready
//The take operator is perfect for this task, because it returns a specific number of arbitrary rows.
// You’ll use the project operator to define which columns you want to see in the output and also to define new columns on the fly on the tabular.
FunctionAppLogs
| project TimeGenerated, HostInstanceId, Message
| where Message == "SOLNOK:"
| take 2
Default retention for functionapplogs
Alerts and logic app
Create a logic app with consumption plan
Go to designer and use http
Go to the log analytics workspace and logs
then go log management and function app logs
FunctionAppLogs
| project TimeGenerated, HostInstanceId, Message
| where Message == "ALERTMSG-COIN"
Now we can create alert rule.
Example
intervall
scedule
Select
Email/SMS message/Push/Voice: Send various notification types to specific recipients.
We can also save the query to the default query pack
saved
Test email
verify alerts and mail group
update 19.03.2024
Insert into table storage