Target
Our focus will be to understand how to enable the log analytics in Azure Logic App and query the Resource Group related logs.
If you don’t have an existing log analytics workspace create a new resource. Search for “Log Analytics Workspace” and click on it. Create a new log analytics workspace.
Fill in the details and select the pricing tier based on your plan. Click on Review + Create.
While creating a new logic app, you’ll be able to see the screen which will have empty box which needs to be filled for creating logic app. You’ll be able to see a log analytics switch button which will be in the off state by default, enable it and select the existing Log analytics workspace. Review + Create the logic app.
If you forgot to turn on Log Analytics feature or you have existing logic app in which you have to enable log analytics workspace feature. Follow the following steps for enabling the log analytics feature for logic app.
Steps
Open your logic app and check the left pane or tray of logic app. Look for Monitoring section and select Diagnostic settings as shown in the image below.
Subsequently we will be able to see the following screen. Click on Add diagnostic setting.
Name the diagnostics of your logic app with some meaningful name and check the following marked checkbox: - log (WorkflowRuntime) and send to log analytics, these checkboxes will send the data to log analytics workspace where we can query and fetch the result of logic app.
Finally save it.
Now run the logic app and check the log by going to the log analytics workspace (LogicAppTestAnalytics). Check that the left pane General section has Logs as highlighted in the below image. Select Logs option.
Following you’ll see the Get Started and after clicking that you’ll be able to land on log analytics query page. As I already ran the AzureDiagnostics command it is showing in query history.
If we write AzureDiagnostics and Run the query we will be able to see every detail of the logic app. The query language is called Kusto query language.We can even filter to more specific results by using where, as shown in below image. I have used the where on my resource group name and it shows all of the logic app records wherever I have enabled the Log Analytics feature.
For deeper knowledge of kusto queries follow this
link.