WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

[AVM Module Issue]: KeyVault Diagnostics defaults are over inclusive #6268

@greg-double

Description

@greg-double

Check for previous/existing GitHub issues

  • I have checked for previous/existing GitHub issues

Issue Type?

Bug

Module Name

avm/res/key-vault/vault

(Optional) Module Version

No response

Description

Module Link

When defining KV diagnostic settings, by default, the module is including data which wasn't requested. For example, the code below indicates I would like just Audit logs enabled as I have excluded the Metrics settings. However, the module defaults to 'All Metrics' if no Metric settings are provided.

    diagnosticSettings: [
      {
        name: 'Audit Logs - LogAnalytics'
        workspaceResourceId: logAnalytics.id
        logCategoriesAndGroups: [
          {
            categoryGroup: 'audit' 
            enabled: true
          }
        ]
      }
    ]

This is the current AVM module code...

      metrics: [
        for group in (diagnosticSetting.?metricCategories ?? [{ category: 'AllMetrics' }]): {
          category: group.category
          enabled: group.?enabled ?? true
          timeGrain: null
        }
      ]
      logs: [
        for group in (diagnosticSetting.?logCategoriesAndGroups ?? [{ categoryGroup: 'allLogs' }]): {
          categoryGroup: group.?categoryGroup
          category: group.?category
          enabled: group.?enabled ?? true
        }
      ]

In this example, I would think it would be more expected to have the Metrics excluded. The inverse is also true, if Metrics are defined and Logs excluded, you'll get all logs enabled,

With the current AVM code, unexpected log ingress and retention costs could result.

Obviously I can work around this by adding a Metrics array and explicitly disabling it, but I think we can do better.

    diagnosticSettings: [
      {
        name: 'Audit Logs - LogAnalytics'
        workspaceResourceId: logAnalytics.id
        logCategoriesAndGroups: [
          {
            categoryGroup: 'audit' 
            enabled: true
          }
        ]
        metricCategories: [
          {
            category: 'AllMetrics'
            enabled: false
          }
        ]
      }
    ]

(Optional) Correlation Id

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Needs: Triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions