Skip to content

azurermLogAnalyticsDataExportRule

Manages a Log Analytics Data Export Rule.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermStorageAccountExample = new azurerm.storageAccount.StorageAccount(
  this,
  "example_1",
  {
    account_replication_type: "LRS",
    account_tier: "Standard",
    location: azurermResourceGroupExample.location,
    name: "examplestoracc",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermStorageAccountExample.overrideLogicalId("example");
const azurermLogAnalyticsWorkspaceExample =
  new azurerm.logAnalyticsWorkspace.LogAnalyticsWorkspace(this, "example_2", {
    location: azurermResourceGroupExample.location,
    name: "exampleworkspace",
    resource_group_name: azurermResourceGroupExample.name,
    retention_in_days: 30,
    sku: "PerGB2018",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermLogAnalyticsWorkspaceExample.overrideLogicalId("example");
const azurermLogAnalyticsDataExportRuleExample =
  new azurerm.logAnalyticsDataExportRule.LogAnalyticsDataExportRule(
    this,
    "example_3",
    {
      destination_resource_id: azurermStorageAccountExample.id,
      enabled: true,
      name: "dataExport1",
      resource_group_name: azurermResourceGroupExample.name,
      table_names: ["Heartbeat"],
      workspace_resource_id: azurermLogAnalyticsWorkspaceExample.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermLogAnalyticsDataExportRuleExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • name - (Required) The name of the Log Analytics Data Export Rule. Changing this forces a new Log Analytics Data Export Rule to be created.

  • resourceGroupName - (Required) The name of the Resource Group where the Log Analytics Data Export should exist. Changing this forces a new Log Analytics Data Export Rule to be created.

  • workspaceResourceId - (Required) The resource ID of the workspace. Changing this forces a new Log Analytics Data Export Rule to be created.

  • destinationResourceId - (Required) The destination resource ID. It should be a storage account, an event hub namespace or an event hub. If the destination is an event hub namespace, an event hub would be created for each table automatically.

  • tableNames - (Required) A list of table names to export to the destination resource, for example: ["heartbeat", "securityEvent"].

  • enabled - (Optional) Is this Log Analytics Data Export Rule enabled? Possible values include true or false. Defaults to false.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Log Analytics Data Export Rule.

  • exportRuleId - The ID of the created Data Export Rule.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Log Analytics Data Export Rule.
  • update - (Defaults to 30 minutes) Used when updating the Log Analytics Data Export Rule.
  • read - (Defaults to 5 minutes) Used when retrieving the Log Analytics Data Export Rule.
  • delete - (Defaults to 30 minutes) Used when deleting the Log Analytics Data Export Rule.

Import

Log Analytics Data Export Rule can be imported using the resourceId, e.g.

terraform import azurerm_log_analytics_data_export_rule.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.OperationalInsights/workspaces/workspace1/dataExports/dataExport1