DiagnosticSetting

class DiagnosticSetting : KotlinCustomResource

Manages a Diagnostic Setting for an existing Resource.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.storage.Account;
import com.pulumi.azure.storage.AccountArgs;
import com.pulumi.azure.core.CoreFunctions;
import com.pulumi.azure.keyvault.KeyVault;
import com.pulumi.azure.keyvault.KeyVaultArgs;
import com.pulumi.azure.monitoring.DiagnosticSetting;
import com.pulumi.azure.monitoring.DiagnosticSettingArgs;
import com.pulumi.azure.monitoring.inputs.DiagnosticSettingEnabledLogArgs;
import com.pulumi.azure.monitoring.inputs.DiagnosticSettingEnabledLogRetentionPolicyArgs;
import com.pulumi.azure.monitoring.inputs.DiagnosticSettingMetricArgs;
import com.pulumi.azure.monitoring.inputs.DiagnosticSettingMetricRetentionPolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.accountTier("Standard")
.accountReplicationType("LRS")
.build());
final var current = CoreFunctions.getClientConfig();
var exampleKeyVault = new KeyVault("exampleKeyVault", KeyVaultArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
.softDeleteRetentionDays(7)
.purgeProtectionEnabled(false)
.skuName("standard")
.build());
var exampleDiagnosticSetting = new DiagnosticSetting("exampleDiagnosticSetting", DiagnosticSettingArgs.builder()
.targetResourceId(exampleKeyVault.id())
.storageAccountId(exampleAccount.id())
.enabledLogs(DiagnosticSettingEnabledLogArgs.builder()
.category("AuditEvent")
.retentionPolicy(DiagnosticSettingEnabledLogRetentionPolicyArgs.builder()
.enabled(false)
.build())
.build())
.metrics(DiagnosticSettingMetricArgs.builder()
.category("AllMetrics")
.retentionPolicy(DiagnosticSettingMetricRetentionPolicyArgs.builder()
.enabled(false)
.build())
.build())
.build());
}
}

Import

Diagnostic Settings can be imported using the resource id, e.g.

$ pulumi import azure:monitoring/diagnosticSetting:DiagnosticSetting example "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.KeyVault/vaults/vault1|logMonitoring1"

Properties

Link copied to clipboard

One or more enabled_log blocks as defined below.

Link copied to clipboard

Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data.

Link copied to clipboard
val eventhubName: Output<String>?

Specifies the name of the Event Hub where Diagnostics Data should be sent.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

Possible values are AzureDiagnostics and Dedicated. When set to Dedicated, logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy AzureDiagnostics table.

Link copied to clipboard

Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent.

Link copied to clipboard

One or more log blocks as defined below.

Link copied to clipboard

One or more metric blocks as defined below.

Link copied to clipboard
val name: Output<String>

Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created.

Link copied to clipboard

The ID of the market partner solution where Diagnostics Data should be sent. For potential partner integrations, click to learn more about partner integration.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val storageAccountId: Output<String>?

The ID of the Storage Account where logs should be sent.

Link copied to clipboard

The ID of an existing Resource on which to configure Diagnostic Settings. Changing this forces a new resource to be created.

Link copied to clipboard
val urn: Output<String>