Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable Azure diagnostics logging using a CLI

I am trying to achieve achieve this, however I would like to enable diagnostics logging using whatever form of non-human interaction possible. I would like to incorporate something that enables diagnostics logging during my build step, by default these are turned off it seems. Any Powsershell (using Azure RM) or visual studio team service build tasks available to make this happen?

like image 200
Lutando Avatar asked Jun 13 '17 05:06

Lutando


People also ask

How do I enable resource logs in Azure?

Send resource logs to a Log Analytics workspace to enable the features of Azure Monitor Logs, where you can: Correlate resource log data with other monitoring data collected by Azure Monitor. Consolidate log entries from multiple Azure resources, subscriptions, and tenants into one location for analysis together.

Can you monitor diagnostics in Azure?

You can configure diagnostic settings in the Azure portal either from the Azure Monitor menu or from the menu for the resource. Where you configure diagnostic settings in the Azure portal depends on the resource: For a single resource, select Diagnostic settings under Monitoring on the resource's menu.


1 Answers

You could do it with Azure CLI 2.0. You could use the following command.

az webapp log config --name
                     --resource-group
                     [--application-logging {false, true}]
                     [--detailed-error-messages {false, true}]
                     [--failed-request-tracing {false, true}]
                     [--level {error, information, verbose, warning}]
                     [--slot]
                     [--web-server-logging {filesystem, off, storage}]

Get help from az help command az webapp log config -h or the official article.

#an example
az webapp log config --name shui -g shuiapp --application-logging true --web-server-logging filesystem
like image 176
Shui shengbao Avatar answered Sep 20 '22 23:09

Shui shengbao