Skip to content

Commit 7c673f0

Browse files
Merge pull request #291447 from whhender/updating-log-analytics-integration
Updating log analytics integration
2 parents 26923e0 + 46eeac4 commit 7c673f0

File tree

2 files changed

+38
-60
lines changed

2 files changed

+38
-60
lines changed

articles/synapse-analytics/spark/apache-spark-azure-log-analytics.md

Lines changed: 38 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ author: jejiang
55
ms.author: jejiang
66
ms.reviewer: whhender
77
ms.service: azure-synapse-analytics
8-
ms.topic: tutorial
8+
ms.topic: how-to
99
ms.subservice: spark
10-
ms.date: 03/25/2021
10+
ms.date: 12/13/2024
1111
ms.custom: references_regions
1212
---
13+
1314
# Monitor Apache Spark applications with Azure Log Analytics
1415

1516
In this tutorial, you learn how to enable the Synapse Studio connector that's built in to Log Analytics. You can then collect and send Apache Spark application metrics and logs to your [Log Analytics workspace](/azure/azure-monitor/logs/quick-create-workspace). Finally, you can use an Azure Monitor workbook to visualize the metrics and logs.
@@ -21,17 +22,18 @@ Follow these steps to configure the necessary information in Synapse Studio.
2122
### Step 1: Create a Log Analytics workspace
2223

2324
Consult one of the following resources to create this workspace:
25+
2426
- [Create a workspace in the Azure portal.](/azure/azure-monitor/logs/quick-create-workspace)
2527
- [Create a workspace with Azure CLI.](/azure/azure-monitor/logs/resource-manager-workspace)
2628
- [Create and configure a workspace in Azure Monitor by using PowerShell.](/azure/azure-monitor/logs/powershell-workspace-configuration)
2729

28-
### Step 2: Prepare an Apache Spark configuration file
30+
### Step 2: Gather configuration information
2931

30-
Use any of the following options to prepare the file.
32+
Use any of the following options to prepare the configuration.
3133

32-
#### Option 1: Configure with Log Analytics workspace ID and key
34+
#### Option 1: Configure with Log Analytics workspace ID and key
3335

34-
Copy the following Apache Spark configuration, save it as *spark_loganalytics_conf.txt*, and fill in the following parameters:
36+
Gather the following values for the spark configuration:
3537

3638
- `<LOG_ANALYTICS_WORKSPACE_ID>`: Log Analytics workspace ID.
3739
- `<LOG_ANALYTICS_WORKSPACE_KEY>`: Log Analytics key. To find this, in the Azure portal, go to **Azure Log Analytics workspace** > **Agents** > **Primary key**.
@@ -50,13 +52,13 @@ spark.synapse.logAnalytics.secret <LOG_ANALYTICS_WORKSPACE_KEY>
5052
To configure Azure Key Vault to store the workspace key, follow these steps:
5153

5254
1. Create and go to your key vault in the Azure portal.
53-
2. On the settings page for the key vault, select **Secrets**.
54-
3. Select **Generate/Import**.
55-
4. On the **Create a secret** screen, choose the following values:
55+
1. On the settings page for the key vault, select **Secrets**.
56+
1. Select **Generate/Import**.
57+
1. On the **Create a secret** screen, choose the following values:
5658
- **Name**: Enter a name for the secret. For the default, enter `SparkLogAnalyticsSecret`.
5759
- **Value**: Enter the `<LOG_ANALYTICS_WORKSPACE_KEY>` for the secret.
5860
- Leave the other values to their defaults. Then select **Create**.
59-
5. Copy the following Apache Spark configuration, save it as *spark_loganalytics_conf.txt*, and fill in the following parameters:
61+
1. Gather the following values for the spark configuration:
6062

6163
- `<LOG_ANALYTICS_WORKSPACE_ID>`: The Log Analytics workspace ID.
6264
- `<AZURE_KEY_VAULT_NAME>`: The key vault name that you configured.
@@ -80,7 +82,7 @@ spark.synapse.logAnalytics.keyVault.key.secret <AZURE_KEY_VAULT_SECRET_KEY_NAME>
8082
To configure a Key Vault linked service in Synapse Studio to store the workspace key, follow these steps:
8183

8284
1. Follow all the steps in the preceding section, "Option 2."
83-
2. Create a Key Vault linked service in Synapse Studio:
85+
1. Create a Key Vault linked service in Synapse Studio:
8486

8587
a. Go to **Synapse Studio** > **Manage** > **Linked services**, and then select **New**.
8688

@@ -90,53 +92,33 @@ To configure a Key Vault linked service in Synapse Studio to store the workspace
9092

9193
d. Choose your key vault, and select **Create**.
9294

93-
3. Add a `spark.synapse.logAnalytics.keyVault.linkedServiceName` item to the Apache Spark configuration.
95+
1. Add a `spark.synapse.logAnalytics.keyVault.linkedServiceName` item to the Apache Spark configuration.
9496

9597
```properties
9698
spark.synapse.logAnalytics.enabled true
9799
spark.synapse.logAnalytics.workspaceId <LOG_ANALYTICS_WORKSPACE_ID>
98-
spark.synapse.logAnalytics.keyVault.name <AZURE_KEY_VAULT_NAME>
99100
spark.synapse.logAnalytics.keyVault.key.secret <AZURE_KEY_VAULT_SECRET_KEY_NAME>
100101
spark.synapse.logAnalytics.keyVault.linkedServiceName <LINKED_SERVICE_NAME>
101102
```
102103

103104
For a list of Apache Spark configurations, see [Available Apache Spark configurations](../monitor-synapse-analytics-reference.md#available-apache-spark-configurations)
104105

105-
### Step 3: Upload your Apache Spark configuration to an Apache Spark pool
106-
107-
> [!NOTE]
108-
>
109-
> This step will be replaced by step 4.
110-
111-
You can upload the configuration file to your Azure Synapse Analytics Apache Spark pool. In Synapse Studio:
112-
113-
1. Select **Manage** > **Apache Spark pools**.
114-
2. Next to your Apache Spark pool, select the **...** button.
115-
3. Select **Apache Spark configuration**.
116-
4. Select **Upload**, and choose the *spark_loganalytics_conf.txt* file.
117-
5. Select **Upload**, and then select **Apply**.
106+
### Step 3: Create an Apache Spark Configuration
118107

119-
> [!div class="mx-imgBorder"]
120-
> ![Screenshot that shows the Spark pool configuration.](./media/apache-spark-azure-log-analytics/spark-pool-configuration.png)
108+
You can create an Apache Spark Configuration to your workspace, and when you create Notebook or Apache spark job definition you can select the Apache Spark configuration that you want to use with your Apache Spark pool. When you select it, the details of the configuration are displayed.
121109

122-
> [!NOTE]
123-
>
124-
> All the Apache Spark applications submitted to the Apache Spark pool will use the configuration setting to push the Apache Spark application metrics and logs to your specified workspace.
125-
126-
127-
### Step 4: Create an Apache Spark Configuration
110+
1. Select **Manage** > **Apache Spark configurations**.
111+
1. Select **New** button to create a new Apache Spark configuration.
112+
1. **New Apache Spark configuration** page will be opened after you select **New** button.
128113

129-
You can create an Apache Spark Configuration to your workspace, and when you create Notebook or Apache spark job definition can select the Apache Spark configuration that you want to use with your Apache Spark pool. When you select it, the details of the configuration are displayed.
114+
:::image type="content" source="./media/apache-spark-azure-log-analytics/create-spark-configuration.png" alt-text="Screenshot that create spark configuration.":::
130115

131-
1. Select **Manage** > **Apache Spark configurations**.
132-
2. Click on **New** button to create a new Apache Spark configuration, or click on **Import** a local .json file to your workspace.
133-
3. **New Apache Spark configuration** page will be opened after you click on **New** button.
134-
4. For **Name**, you can enter your preferred and valid name.
135-
5. For **Description**, you can input some description in it.
136-
6. For **Annotations**, you can add annotations by clicking the **New** button, and also you can delete existing annotations by selecting and clicking **Delete** button.
137-
7. For **Configuration properties**, customize the configuration by clicking **Add** button to add properties. If you do not add a property, Azure Synapse will use the default value when applicable.
116+
1. For **Name**, you can enter your preferred and valid name.
117+
1. For **Description**, you can input some description in it.
118+
1. For **Annotations**, you can add annotations by clicking the **New** button, and also you can delete existing annotations by selecting and clicking **Delete** button.
119+
1. For **Configuration properties**, add all the properties from the configuration option you chose by selecting the **Add** button. For **Property** add the property name as listed, and for **Value** use the value you gathered during step 2. If you don't add a property, Azure Synapse will use the default value when applicable.
138120

139-
![Screenshot that create spark configuration.](./media/apache-spark-azure-log-analytics/create-spark-configuration.png)
121+
:::image type="content" source="./media/apache-spark-azure-log-analytics/spark-configuration.png" alt-text="Screenshot with an example for updating configuration properties.":::
140122

141123
## Submit an Apache Spark application and view the logs and metrics
142124

@@ -236,8 +218,6 @@ SparkMetrics_CL
236218
| order by TimeGenerated asc
237219
```
238220

239-
240-
241221
## Create and manage alerts
242222

243223
Users can query to evaluate metrics and logs at a set frequency, and fire an alert based on the results. For more information, see [Create, view, and manage log alerts by using Azure Monitor](/azure/azure-monitor/alerts/alerts-log).
@@ -246,29 +226,27 @@ Users can query to evaluate metrics and logs at a set frequency, and fire an ale
246226

247227
After the Synapse workspace is created with [data exfiltration protection](../security/workspace-data-exfiltration-protection.md) enabled.
248228

249-
When you want to enable this feature, you need to create managed private endpoint connection requests to [Azure Monitor private link scopes (A M P L S)](/azure/azure-monitor/logs/private-link-security) in the workspace’s approved Microsoft Entra tenants.
229+
When you want to enable this feature, you need to create managed private endpoint connection requests to [Azure Monitor private link scopes (AMPLS)](/azure/azure-monitor/logs/private-link-security) in the workspace’s approved Microsoft Entra tenants.
250230

251-
You can follow below steps to create a managed private endpoint connection to Azure Monitor private link scopes (A M P L S):
231+
You can follow below steps to create a managed private endpoint connection to Azure Monitor private link scopes (AMPLS):
252232

253-
1. If there is no existing A M P L S, you can follow [Azure Monitor Private Link connection setup](/azure/azure-monitor/logs/private-link-security) to create one.
254-
2. Navigate to your A M P L S in Azure portal, on the **Azure Monitor Resources** page, click **Add** to add connection to your Azure Log Analytics workspace.
255-
3. Navigate to **Synapse Studio > Manage > Managed private endpoints**, click **New** button, select **Azure Monitor Private Link Scopes**, and **continue**.
233+
1. If there's no existing AMPLS, you can follow [Azure Monitor Private Link connection setup](/azure/azure-monitor/logs/private-link-security) to create one.
234+
1. Navigate to your AMPLS in Azure portal, on the **Azure Monitor Resources** page, select **Add** to add connection to your Azure Log Analytics workspace.
235+
1. Navigate to **Synapse Studio > Manage > Managed private endpoints**, select **New** button, select **Azure Monitor Private Link Scopes**, and **continue**.
256236
> [!div class="mx-imgBorder"]
257-
> ![Screenshot of create A M P L S managed private endpoint 1.](./media/apache-spark-azure-log-analytics/create-ampls-private-endpoint-1.png)
258-
4. Choose your Azure Monitor Private Link Scope you created, and click **Create** button.
237+
> ![Screenshot of create AMPLS managed private endpoint 1.](./media/apache-spark-azure-log-analytics/create-ampls-private-endpoint-1.png)
238+
1. Choose your Azure Monitor Private Link Scope you created, and select **Create** button.
259239
> [!div class="mx-imgBorder"]
260-
> ![Screenshot of create A M P L S managed private endpoint 2.](./media/apache-spark-azure-log-analytics/create-ampls-private-endpoint-2.png)
261-
5. Wait a few minutes for private endpoint provisioning.
262-
6. Navigate to your A M P L S in Azure portal again, on the **Private Endpoint connections** page, select the connection provisioned and **Approve**.
240+
> ![Screenshot of create AMPLS managed private endpoint 2.](./media/apache-spark-azure-log-analytics/create-ampls-private-endpoint-2.png)
241+
1. Wait a few minutes for private endpoint provisioning.
242+
1. Navigate to your AMPLS in Azure portal again, on the **Private Endpoint connections** page, select the connection provisioned and **Approve**.
263243

264-
> [!NOTE]
265-
> - The A M P L S object has a number of limits you should consider when planning your Private Link setup. See [A M P L S limits](/azure/azure-monitor/logs/private-link-security) for a deeper review of these limits.
244+
> [!NOTE]
245+
> - The AMPLS object has a number of limits you should consider when planning your Private Link setup. See [AMPLS limits](/azure/azure-monitor/logs/private-link-security) for a deeper review of these limits.
266246
> - Check if you have [right permission](../security/synapse-workspace-access-control-overview.md) to create managed private endpoint.
267247
268-
## Next steps
248+
## Related content
269249

270-
- [Use serverless Apache Spark pool in Synapse Studio](../quickstart-create-apache-spark-pool-studio.md).
271250
- [Run a Spark application in notebook](./apache-spark-development-using-notebooks.md).
272-
- [Create Apache Spark job definition in Azure Studio](./apache-spark-job-definitions.md).
273251
- [Collect Apache Spark applications logs and metrics with Azure Storage account](./azure-synapse-diagnostic-emitters-azure-storage.md).
274252
- [Collect Apache Spark applications logs and metrics with Azure Event Hubs](./azure-synapse-diagnostic-emitters-azure-eventhub.md).
49.3 KB
Loading

0 commit comments

Comments
 (0)