states.azurerm.monitor.diagnostic_setting¶
Azure Resource Manager (ARM) Diagnostic Setting State Module
New in version 2.0.0.
maintainer: | |
---|---|
configuration: | This module requires Azure Resource Manager credentials to be passed via acct. Note that the authentication parameters are case sensitive. Required provider parameters:
Optional provider parameters: cloud_environment: Used to point the cloud driver to different API endpoints, such as Azure GovCloud. Possible values:
Example acct setup for Azure Resource Manager authentication: azurerm:
default:
subscription_id: 3287abc8-f98a-c678-3bde-326766fd3617
tenant: ABCDEFAB-1234-ABCD-1234-ABCDEFABCDEF
client_id: ABCDEFAB-1234-ABCD-1234-ABCDEFABCDEF
secret: XXXXXXXXXXXXXXXXXXXXXXXX
cloud_environment: AZURE_PUBLIC_CLOUD
user_pass_auth:
subscription_id: 3287abc8-f98a-c678-3bde-326766fd3617
username: fletch
password: 123pass
The authentication parameters can also be passed as a dictionary of keyword arguments to the |
-
idem_azurerm.states.azurerm.monitor.diagnostic_setting.
absent
(hub, ctx, name, resource_uri, connection_auth=None, **kwargs)¶ New in version 2.0.0.
Ensure a diagnostic setting does not exist for the specified resource uri.
Parameters: - name – The name of the diagnostic setting.
- resource_uri – The identifier of the resource.
- connection_auth – A dict with subscription and authentication parameters to be used in connecting to the Azure Resource Manager API.
Example usage:
Ensure diagnostic setting is absent: azurerm.monitor.diagnostic_setting.absent: - name: my_setting - resource_uri: my_resource
-
idem_azurerm.states.azurerm.monitor.diagnostic_setting.
present
(hub, ctx, name, resource_uri, metrics, logs, workspace_id=None, log_analytics_destination_type=None, storage_account_id=None, event_hub_name=None, event_hub_authorization_rule_id=None, connection_auth=None, **kwargs)¶ New in version 2.0.0.
Changed in version 4.0.0.
Ensure a diagnostic setting exists. At least one destination for the diagnostic setting logs is required. Any combination of the following destinations is acceptable:
- Archive the diagnostic settings to a storage account. This would require the
storage_account_id
parameter.
2. Stream the diagnostic settings to an event hub. This would require the
event_hub_name
andevent_hub_authorization_rule_id
parameters. 3. Send the diagnostic settings to Log Analytics. This would require theworkspace_id
parameter.Parameters: - name – The name of the diagnostic setting.
- resource_uri – The identifier of the resource.
- metrics –
A list of dictionaries representing valid MetricSettings objects. If this list is empty, then the list passed as the logs parameter must have at least one element. Valid parameters are:
category
: Name of a diagnostic metric category for the resource type this setting is applied to. To obtain the list of diagnostic metric categories for a resource, first perform a GET diagnostic setting operation. This is a required parameter.enabled
: A value indicating whether this category is enabled. This is a required parameter.time_grain
: An optional timegrain of the metric in ISO-8601 format.retention_policy
: An optional dictionary representing a RetentionPolicy object for the specified category. The default retention policy for a diagnostic setting is {‘enabled’: False, ‘days’: 0}. Required parameters include:days
: The number of days for the retention in days. A value of 0 will retain the events indefinitely.enabled
: A value indicating whether the retention policy is enabled.
- logs –
A list of dictionaries representing valid LogSettings objects. If this list is empty, then the list passed as the metrics parameter must have at least one element. Valid parameters are:
category
: Name of a diagnostic log category for the resource type this setting is applied to. To obtain the list of diagnostic log categories for a resource, first perform a GET diagnostic setting operation. This is a required parameter.enabled
: A value indicating whether this category is enabled. This is a required parameter.retention_policy
: An optional dictionary representing a RetentionPolicy object for the specified category. The default retention policy for a diagnostic setting is {‘enabled’: False, ‘days’: 0}. Required parameters include:days
: The number of days for the retention in days. A value of 0 will retain the events indefinitely.enabled
: A value indicating whether the retention policy is enabled.
- workspace_id – The resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Required if you want to send the diagnostic settings data to Log Analytics.
- log_analytics_destination_type – A string indicating whether the export to the Log Analytics Workspace
should store the logs within the legacy default destination type, the AzureDiagnostics table, or a dedicated,
resource specific table. Optional, used with the
workspace_id
parameter. Possible values include: “Dedicated” and “AzureDiagnostics”. - storage_account_id – The resource ID of the storage account to which you would like to send Diagnostic Logs. Required if you want to archive the diagnostic settings data to a storage account.
- event_hub_name – The name of the event hub. If none is specified, the default event hub will be selected. Required to stream the diagnostic settings data to an event hub.
- event_hub_authorization_rule_id – The resource ID for the event hub authorization rule. Required with the
event_hub_name
parameter. - connection_auth – A dict with subscription and authentication parameters to be used in connecting to the Azure Resource Manager API.
Example usage:
Ensure diagnostic setting exists: azurerm.monitor.diagnostic_setting.present: - name: my_setting - resource_uri: my_resource - metrics: - category: my_category enabled: True retention_policy: enabled: True days: 10 - logs: - category: my_category enabled: True - storage_account_id: my_account_id
- Archive the diagnostic settings to a storage account. This would require the