Introduction
In this blog, we will learn how to log messages to Azure Log Analytics workspace using MS Flow.
Prerequisite
- Log Analytics workspace should be created
- Workspace ID, primary key should be known beforehand
Steps to be used in flow
Firstly, we will create a simple MS flow log the message in Log Analytics. Please follow below steps.
- Create a flow with manual trigger.

- Click on ‘New Step’ and search for ‘Send data’ and select ‘Send Data’ action.

- Once you select the action, it will be available on the flow and will ask for the following details.

- Now in the Connection Name, you can put relevant name, which will be used while querying the logs for Log Analytics. I am putting – FlowLALogging
- In the workspace Id and Workspace key, put respective values from log analytics.
- To know the workspace id, open the log analytics and click on overview.

- To get the Workspace Key, go to advanced setting and copy primary or secondary key.

- After entering the values once you click on Create, the ‘Send Data’ action will be changed as below,

- Enter values in all the three fields as follows
- JSON Request body - Message to be logged in, should be in JSON format.
- Custom LOG Name – Connection name used in step 5. For me it is FlowLALogging
-
Time-generated-field – Represents the date and time of logging.
- The JSON request body should be in below format,
- [
- {
- "Action 1": "Testing LA Logging 1",
- "Action 2": "Testing LA Logging 2"
- }
- ]
-
In the custom Log Name – FlowLALogging

-
Now save the workflow and run it manually.
- Your flow should run successfully.
- Now wait for 5 minutes so that log data should be available for query.
- After 5 minutes go to Log Analytics - Log and run below command.
- FlowLALogging_CL| limit 50
‘_CL’ is the suffix added for each custom key. It stands for Custom Logging.

Robin RoyPosted Nov 28, 2022, 7:03 AM
Hi, I'm getting the below error when sending logs: "message": "The response is not in a JSON format.", "innerError": "Cannot read server response." status code: 403. I have contributor access to the analytics workspace. What could be the issue?
Rajesh BishtPosted Aug 22, 2019, 7:13 AM
GOOD KEEP IT UP.