如何使用 Terraform 将 LogAnalyticsWorkSpace 与数据工厂集成?
How to integrate LogAnalyticsWorkSpace with Data Factory using Terraform?
如何使用 Terraform 部署 Azure 数据工厂以及使用 LogAnalyticsWorkSpace 进行监控?
考虑到您想要部署 Azure 数据工厂并将其 logs/metrics 从 Azure Monitor 路由到 Azure Log analytics Workspace 的基本设置,下面的 Terraform 代码已经过测试。如果您想进一步包括任何具体内容,请告诉我。
这是我的 main.tf
的样子:
provider "azurerm" {
features { }
}
#Manages an Azure Data Factory (Version 2).
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_data_factory" "example" {
name = "example"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
}
resource "azurerm_storage_account" "example" {
name = "examplesa"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "GRS"
}
#create log analytics workspace
resource "azurerm_log_analytics_workspace" "example" {
name = "acctest-01"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
sku = "PerGB2018"
retention_in_days = 30
}
#Manages an ADF logs within Azure Monitor with Log Analytics Workspace.
resource "azurerm_monitor_diagnostic_setting" "example" {
name = "example"
target_resource_id = azurerm_data_factory.example.id
storage_account_id = azurerm_storage_account.example.id
log_analytics_workspace_id = azurerm_log_analytics_workspace.example.id
log_analytics_destination_type = "Dedicated"
log {
category = "AuditEvent"
enabled = false
retention_policy {
enabled = false
}
}
metric {
category = "AllMetrics"
retention_policy {
enabled = false
}
}
}
根据需要使用变量或重命名资源....
注意:可用的指标类别因所使用的资源而异。
请参阅 Azure 数据工厂版本 2
发出的 here 指标
如何使用 Terraform 部署 Azure 数据工厂以及使用 LogAnalyticsWorkSpace 进行监控?
考虑到您想要部署 Azure 数据工厂并将其 logs/metrics 从 Azure Monitor 路由到 Azure Log analytics Workspace 的基本设置,下面的 Terraform 代码已经过测试。如果您想进一步包括任何具体内容,请告诉我。
这是我的 main.tf
的样子:
provider "azurerm" {
features { }
}
#Manages an Azure Data Factory (Version 2).
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_data_factory" "example" {
name = "example"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
}
resource "azurerm_storage_account" "example" {
name = "examplesa"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "GRS"
}
#create log analytics workspace
resource "azurerm_log_analytics_workspace" "example" {
name = "acctest-01"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
sku = "PerGB2018"
retention_in_days = 30
}
#Manages an ADF logs within Azure Monitor with Log Analytics Workspace.
resource "azurerm_monitor_diagnostic_setting" "example" {
name = "example"
target_resource_id = azurerm_data_factory.example.id
storage_account_id = azurerm_storage_account.example.id
log_analytics_workspace_id = azurerm_log_analytics_workspace.example.id
log_analytics_destination_type = "Dedicated"
log {
category = "AuditEvent"
enabled = false
retention_policy {
enabled = false
}
}
metric {
category = "AllMetrics"
retention_policy {
enabled = false
}
}
}
根据需要使用变量或重命名资源....
注意:可用的指标类别因所使用的资源而异。 请参阅 Azure 数据工厂版本 2
发出的 here 指标