尝试通过Terraform添加LinuxDiagnostic Azure VM Extension并获取错误 [英] Trying to add LinuxDiagnostic Azure VM Extension through terraform and getting errors

查看:144
本文介绍了尝试通过Terraform添加LinuxDiagnostic Azure VM Extension并获取错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过terraform来添加LinuxDiagnostic扩展.

虚拟机为:

  azure_image_publisher ="Redhat"azure_image_offer ="RHEL"azure_image_sku ="7.8" 

我的部署如下:

 资源"azurerm_virtual_machine_extension""diagnostics_linux" {count = local.is_windows == true?0比1名称="LinuxDiagnostic"virtual_machine_id = azurerm_virtual_machine.main.id发布者="Microsoft.Azure.Diagnostics"类型="LinuxDiagnostic"type_handler_version ="3.0"auto_upgrade_minor_version ="true"设置=<<设置{"storageAccount":"$ {var.stackSettings.azurerm_storage_account.name}","ladCfg":{"diagnosticMonitorConfiguration":{"eventVolume":中",指标":{"metricAggregation":[{"scheduledTransferPeriod":"PT1M"},{"scheduledTransferPeriod":"PT1H"}],"resourceId":"/subscriptions/${var.stackSettings.azure_subscription_id}/resourceGroups/${var.stackSettings.azurerm_resource_group}/providers/Microsoft.Compute/virtualMachines/${azurerm_virtual_machine.main.id}"},"syslogEvents":{/** syslog列表**/},"performanceCounters":{/**性能计数器列表**/}},"sampleRateInSeconds":15}}设定protected_settings =<<设置{"storageAccountName":"$ {var.stackSettings.azurerm_storage_account.name}","storageAccountKey":"$ {var.stackSettings.azurerm_storage_account.primary_access_key}","storageAccountEndPoint":"https://core.windows.net"}设定Depends_on = [azurerm_virtual_machine.main]} 

每次我尝试通过terraform进行申请时,都会收到错误消息:

 错误:Code ="VMExtensionProvisioningError" Message ="VM在处理扩展'LinuxDiagnostic'时报告了故障.错误消息:\"扩展操作启用失败:'NoneType'对象没有属性'get_fluentd_syslog_src_config'\"\ r \ n \ r \ n有关故障排除的更多信息,请访问https://aka.ms/VMExtensionLinuxDiagnosticsTroubleshoot在资源"azurerm_virtual_machine_extension""diagnostics_linux"中的.. \ .. \ .. \ .. \ modules \ Azure-Server \ v1 \ main.tf行284上:284:资源"azurerm_virtual_machine_extension""diagnostics_linux" { 

我的Windows诊断扩展正常工作,并且我通过门户从工作部署中直接获取了JSON.

正在寻求有关我可能会缺少的东西的帮助.或者,如果有人使用XML LAD版本,我也会尝试(在任何地方都找不到).

谢谢!

编辑

完整的解决方案(包括获取讨厌的SAS令牌并从json文件而不是巨大的Terrform块中读取!)Terraform配置:

 /**Linux诊断代理linux诊断代理的工作相当复杂.你需要:1.开始/到期时间的静态时间戳2.具有自定义权限的存储帐户中的SAS令牌3.通过自定义清理导入多个大型json这一切都在下面照顾**///==用于存储时间戳SAS令牌生存期的提供程序==//提供者时间" {版本=〜> 0.4"}//==未来存储10年==//资源"time_offset""linux_oms_sas_expiry" {count = local.is_windows == true?0比1offset_years = 10}//==存储(现在-10)天,以确保我们拥有有效的SAS ==//资源"time_offset""linux_oms_sas_start" {count = local.is_windows == true?0比1offset_days = -10}//==诊断扩展所需的SAS令牌==///**权限基于此处创建的Linux powershell sas:https://docs.microsoft.com/zh-cn/azure/virtual-machines/extensions/diagnostics-linux**/数据"azurerm_storage_account_sas""linux_oms" {count = local.is_windows == true?0比1connection_string = var.stackSettings.azurerm_storage_account.primary_connection_stringhttps_only = trueresource_types {服务=真容器= true对象=真}服务 {blob = true表=真队列=假文件=假}开始= time_offset.linux_oms_sas_start [0] .rfc3339到期时间= time_offset.linux_oms_sas_expiry [0] .rfc3339权限{读=真写=真删除=真列表=真加=真创建=真更新=真过程=真}}//===安装诊断扩展程序===//资源"azurerm_virtual_machine_extension""diagnostics_linux" {count = local.is_windows == true?0比1名称="LinuxDiagnostic"virtual_machine_id = azurerm_virtual_machine.main.id发布者="Microsoft.Azure.Diagnostics"类型="LinuxDiagnostic"type_handler_version ="3.0"auto_upgrade_minor_version ="true"设置=<<设置{"StorageAccount":"$ {var.stackSettings.azurerm_storage_account.name}","ladCfg":{"diagnosticMonitorConfiguration":{"eventVolume":中",指标":{"metricAggregation":[{"scheduledTransferPeriod":"PT1H"},{"scheduledTransferPeriod":"PT1M"}],"resourceId":"$ {azurerm_virtual_machine.main.id}"},"performanceCounters":$ {file("$ {path.module}/azure_jsons/azure_extension_diagnostics_linux_performancecounters.json")},"syslogEvents":$ {file("$ {path.module}/azure_jsons/azure_extension_diagnostics_linux_syslogevents.json")}},"sampleRateInSeconds":15}}设定protected_settings =<<设置{"storageAccountName":"$ {var.stackSettings.azurerm_storage_account.name}","storageAccountSasToken":"$ {data.azurerm_storage_account_sas.linux_oms [0] .sas}","storageAccountEndPoint":"https://core.windows.net","sinksConfig":{下沉": [{"name":"SyslogJsonBlob","type":"JsonBlob"},{"name":"LinuxCpuJsonBlob","type":"JsonBlob"}]}}设定Depends_on = [azurerm_virtual_machine.main]} 

azure_extension_diagnostics_linux_performancecounters.json:

  {"performanceCounterConfiguration":[{注释":[{"displayName":磁盘读取来宾操作系统","locale":"zh-cn"}],"class":"disk","condition":"IsAggregate = TRUE","counter":"readbytespersecond","counterSpecifier":"/builtin/disk/readbytespersecond","type":"builtin",单位":"BytesPerSecond"},{注释":[{"displayName":磁盘写入","locale":"zh-cn"}],"class":"disk","condition":"IsAggregate = TRUE","counter":"writespersecond","counterSpecifier":"/builtin/disk/writespersecond","type":"builtin","unit":"CountPerSecond"},{注释":[{"displayName":磁盘传输时间","locale":"zh-cn"}],"class":"disk","condition":"IsAggregate = TRUE","counter":"averagetransfertime","counterSpecifier":"/内置/磁盘/平均传输时间","type":"builtin","unit":"Seconds"},{注释":[{"displayName":磁盘传输","locale":"zh-cn"}],"class":"disk","condition":"IsAggregate = TRUE","counter":每秒传输","counterSpecifier":"/builtin/disk/transferspersecond","type":"builtin","unit":"CountPerSecond"},{注释":[{"displayName":磁盘写来宾操作系统","locale":"en-us"}],"class":"disk","condition":"IsAggregate = TRUE","counter":"writebytespersecond","counterSpecifier":"/builtin/disk/writebytespersecond","type":"builtin",单位":"BytesPerSecond"},{注释":[{"displayName":磁盘读取时间","locale":"en-us"}],"class":"disk","condition":"IsAggregate = TRUE","counter":"averagereadtime","counterSpecifier":"/内置/磁盘/平均读取时间","type":"builtin","unit":"Seconds"},{注释":[{"displayName":磁盘写入时间","locale":"zh-cn"}],"class":"disk","condition":"IsAggregate = TRUE","counter":"averagewritetime","counterSpecifier":"/builtin/disk/averagewritetime","type":"builtin","unit":"Seconds"},{注释":[{"displayName":磁盘总字节","locale":"zh-cn"}],"class":"disk","condition":"IsAggregate = TRUE","counter":"bytespersecond","counterSpecifier":"/builtin/disk/bytespersecond","type":"builtin",单位":"BytesPerSecond"},{注释":[{"displayName":磁盘读取","locale":"zh-cn"}],"class":"disk","condition":"IsAggregate = TRUE","counter":"readspersecond","counterSpecifier":"/builtin/disk/readspersecond","type":"builtin","unit":"CountPerSecond"},{注释":[{"displayName":磁盘队列长度","locale":"zh-cn"}],"class":"disk","condition":"IsAggregate = TRUE","counter":"averagediskqueuelength","counterSpecifier":"/builtin/disk/averagediskqueuelength","type":"builtin","unit":"Count"},{注释":[{"displayName":来宾操作系统中的网络","locale":"zh-cn"}],"class":网络","counter":已接收的字节","counterSpecifier":"/builtin/network/bytesreceived","type":"builtin",单位":字节"},{注释":[{"displayName":网络总字节数","locale":"zh-cn"}],"class":网络","counter":"bytestotal","counterSpecifier":"/内置/网络/字节存储","type":"builtin",单位":字节"},{注释":[{"displayName":网络输出访客操作系统","locale":"zh-cn"}],"class":网络","counter":已传输的字节","counterSpecifier":"/内建/网络/传输的字节数","type":"builtin",单位":字节"},{注释":[{"displayName":网络冲突","locale":"en-us"}],"class":网络","counter":"totalcollisions","counterSpecifier":"/builtin/network/totalcollisions","type":"builtin","unit":"Count"},{注释":[{"displayName":数据包收到错误","locale":"zh-cn"}],"class":网络","counter":"totalrxerrors","counterSpecifier":"/builtin/network/totalrxerrors","type":"builtin","unit":"Count"},{注释":[{"displayName":已发送数据包","locale":"zh-cn"}],"class":网络","counter":"packetstransmitted","counterSpecifier":"/builtin/network/packetstransmitted","type":"builtin","unit":"Count"},{注释":[{"displayName":已收到数据包","locale":"zh-cn"}],"class":网络","counter":收到的数据包","counterSpecifier":"/builtin/network/packetsreceived","type":"builtin","unit":"Count"},{注释":[{"displayName":数据包发送错误","locale":"zh-cn"}],"class":网络","counter":"totaltxerrors","counterSpecifier":"/builtin/network/totaltxerrors","type":"builtin","unit":"Count"},{注释":[{"displayName":文件系统传输/秒","locale":"zh-cn"}],"class":文件系统","condition":"IsAggregate = TRUE","counter":每秒传输","counterSpecifier":"/builtin/filesystem/transferspersecond","type":"builtin","unit":"CountPerSecond"},{注释":[{"displayName":文件系统可用空间百分比","locale":"zh-cn"}],"class":文件系统","condition":"IsAggregate = TRUE","counter":"percentfreespace","counterSpecifier":"/builtin/filesystem/percentfreespace","type":"builtin",单位":百分比"},{注释":[{"displayName":文件系统已用空间%","locale":"zh-cn"}],"class":文件系统","condition":"IsAggregate = TRUE","counter":"percentusedspace","counterSpecifier":"/builtin/filesystem/percentusedspace","type":"builtin",单位":百分比"},{注释":[{"displayName":文件系统使用的空间","locale":"zh-cn"}],"class":文件系统","condition":"IsAggregate = TRUE","counter":"usedspace","counterSpecifier":"/builtin/filesystem/usedspace","type":"builtin",单位":字节"},{注释":[{"displayName":文件系统读取字节/秒","locale":"zh-cn"}],"class":文件系统","condition":"IsAggregate = TRUE","counter":"bytesreadpersecond","counterSpecifier":"/builtin/filesystem/bytesreadpersecond","type":"builtin","unit":"CountPerSecond"},{注释":[{"displayName":文件系统可用空间","locale":"zh-cn"}],"class":文件系统","condition":"IsAggregate = TRUE","counter":自由空间","counterSpecifier":"/builtin/filesystem/freespace","type":"builtin",单位":字节"},{注释":[{"displayName":文件系统%空闲索引节点","locale":"zh-cn"}],"class":文件系统","condition":"IsAggregate = TRUE","counter":"percentfreeinodes","counterSpecifier":"/builtin/filesystem/percentfreeinodes","type":"builtin",单位":百分比"},{注释":[{"displayName":文件系统字节/秒","locale":"zh-cn"}],"class":文件系统","condition":"IsAggregate = TRUE","counter":"bytespersecond","counterSpecifier":"/builtin/filesystem/bytespersecond","type":"builtin",单位":"BytesPerSecond"},{注释":[{"displayName":文件系统读取/秒","locale":"en-us"}],"class":文件系统","condition":"IsAggregate = TRUE","counter":"readspersecond","counterSpecifier":"/builtin/filesystem/readspersecond","type":"builtin","unit":"CountPerSecond"},{注释":[{"displayName":文件系统写入字节/秒","locale":"zh-cn"}],"class":文件系统","condition":"IsAggregate = TRUE","counter":"byteswritepersecond","counterSpecifier":"/内建/文件系统/每秒写入的字节数","type":"builtin","unit":"CountPerSecond"},{注释":[{"displayName":文件系统写入/秒","locale":"zh-cn"}],"class":文件系统","condition":"IsAggregate = TRUE","counter":"writespersecond","counterSpecifier":"/builtin/filesystem/writespersecond","type":"builtin","unit":"CountPerSecond"},{注释":[{"displayName":文件系统%使用了inode","locale":"zh-cn"}],"class":文件系统","condition":"IsAggregate = TRUE","counter":"percentusedinodes","counterSpecifier":"/builtin/filesystem/percentusedinodes","type":"builtin",单位":百分比"},{注释":[{"displayName":"CPU IO等待时间","locale":"zh-cn"}],"class":处理器","condition":"IsAggregate = TRUE","counter":"percentiowaittime","counterSpecifier":"/builtin/processor/percentiowaittime","type":"builtin",单位":百分比"},{注释":[{"displayName":"CPU用户时间","locale":"zh-cn"}],"class":处理器","condition":"IsAggregate = TRUE","counter":"percentusertime","counterSpecifier":"/builtin/processor/percentusertime","type":"builtin",单位":百分比"},{注释":[{"displayName":"CPU正常时间","locale":"zh-cn"}],"class":处理器","condition":"IsAggregate = TRUE","counter":"percentnicetime","counterSpecifier":"/builtin/processor/percentnicetime","type":"builtin",单位":百分比"},{注释":[{"displayName":来宾操作系统的CPU百分比","locale":"zh-cn"}],"class":处理器","condition":"IsAggregate = TRUE","counter":"percentprocessortime","counterSpecifier":"/内置/处理器/处理器时间百分比","type":"builtin",单位":百分比"},{注释":[{"displayName":"CPU中断时间","locale":"zh-cn"}],"class":处理器","condition":"IsAggregate = TRUE","counter":"percentinterrupttime","counterSpecifier":"/builtin/processor/percentinterrupttime","type":"builtin",单位":百分比"},{注释":[{"displayName":"CPU空闲时间","locale":"zh-cn"}],"class":处理器","condition":"IsAggregate = TRUE","counter":"percentidletime","counterSpecifier":"/builtin/processor/percentidletime","type":"builtin",单位":百分比"},{注释":[{"displayName":"CPU特权时间","locale":"en-us"}],"class":处理器","condition":"IsAggregate = TRUE","counter":"percentprivilegedtime","counterSpecifier":"/内建/处理器/percentprivilegedtime","type":"builtin",单位":百分比"},{注释":[{"displayName":可用内存","locale":"zh-cn"}],"class":内存","counter":"availablememory","counterSpecifier":"/内置/内存/可用内存","type":"builtin",单位":字节"},{注释":[{"displayName":已使用交换百分比","locale":"zh-cn"}],"class":内存","counter":"percentusedswap","counterSpecifier":"/builtin/memory/percentusedswap","type":"builtin",单位":百分比"},{注释":[{"displayName":已使用的内存","locale":"zh-cn"}],"class":内存","counter":"usedmemory","counterSpecifier":"/builtin/memory/usedmemory","type":"builtin",单位":字节"},{注释":[{"displayName":页面读取","locale":"zh-cn"}],"class":内存","counter":"pagesreadpersec","counterSpecifier":"/builtin/memory/pagesreadpersec","type":"builtin","unit":"CountPerSecond"},{注释":[{"displayName":可交换","locale":"zh-cn"}],"class":内存","counter":"availableswap","counterSpecifier":"/内置/内存/availableswap","type":"builtin",单位":字节"},{注释":[{"displayName":可用交换百分比","locale":"zh-cn"}],"class":内存","counter":"percentavailableswap","counterSpecifier":"/builtin/memory/percentavailableswap","type":"builtin",单位":百分比"},{注释":[{"displayName":可用的百分比.","locale":"zh-cn"}],"class":内存","counter":"percentavailablememory","counterSpecifier":"/builtin/memory/percentavailablememory","type":"builtin",单位":百分比"},{注释":[{"displayName":页面","locale":"zh-cn"}],"class":内存","counter":"pagespersec","counterSpecifier":"/builtin/memory/pagespersec","type":"builtin","unit":"CountPerSecond"},{注释":[{"displayName":已使用交换","locale":"zh-cn"}],"class":内存","counter":"usedswap","counterSpecifier":"/builtin/memory/usedswap","type":"builtin",单位":字节"},{注释":[{"displayName":内存百分比","locale":"zh-cn"}],"class":内存","counter":"percentusedmemory","counterSpecifier":"/builtin/memory/percentusedmemory","type":"builtin",单位":百分比"},{注释":[{"displayName":页面写入","locale":"zh-cn"}],"class":内存","counter":"pageswriterpersec","counterSpecifier":"/builtin/memory/pageswritepersec","type":"builtin","unit":"CountPerSecond"}]} 

azure_extension_diagnostics_linux_syslogevents.json

  {"syslogEventConfiguration":{"LOG_AUTH":"LOG_DEBUG","LOG_AUTHPRIV":"LOG_DEBUG","LOG_CRON":"LOG_DEBUG","LOG_DAEMON":"LOG_DEBUG","LOG_FTP":"LOG_DEBUG","LOG_KERN":"LOG_DEBUG","LOG_LOCAL0":"LOG_DEBUG","LOG_LOCAL1":"LOG_DEBUG","LOG_LOCAL2":"LOG_DEBUG","LOG_LOCAL3":"LOG_DEBUG","LOG_LOCAL4":"LOG_DEBUG","LOG_LOCAL5":"LOG_DEBUG","LOG_LOCAL6":"LOG_DEBUG","LOG_LOCAL7":"LOG_DEBUG","LOG_LPR":"LOG_DEBUG","LOG_MAIL":"LOG_DEBUG","LOG_NEWS":"LOG_DEBUG","LOG_SYSLOG":"LOG_DEBUG","LOG_USER":"LOG_DEBUG","LOG_UUCP":"LOG_DEBUG"}} 

编辑2

如果需要,可以开始使用模块:

正如我们所说的,Terraform尚不支持Azure EVent集线器的SAS令牌(暂时)(目前仅支持azure存储),所以我们不能使用terraform来做到这一点,我打开了一个github issue, let's see if this is going to be added.

I am trying to get the LinuxDiagnostic extension to add via terraform.

The VM is:

azure_image_publisher = "Redhat"
azure_image_offer     = "RHEL"
azure_image_sku       = "7.8"

My deploy looks like this:

resource "azurerm_virtual_machine_extension" "diagnostics_linux" {
  count                      = local.is_windows == true ? 0 : 1
  name                       = "LinuxDiagnostic"
  virtual_machine_id         =  azurerm_virtual_machine.main.id
  publisher                  = "Microsoft.Azure.Diagnostics"
  type                       = "LinuxDiagnostic"
  type_handler_version       = "3.0"
  auto_upgrade_minor_version = "true"

  settings = <<SETTINGS
    {
        "storageAccount": "${var.stackSettings.azurerm_storage_account.name}",
        "ladCfg": {
                        "diagnosticMonitorConfiguration": {
                            "eventVolume": "Medium",
                            "metrics": {
                                "metricAggregation": [
                                    {
                                        "scheduledTransferPeriod": "PT1M"
                                    },
                                    {
                                        "scheduledTransferPeriod": "PT1H"
                                    }
                                ],
                                "resourceId": "/subscriptions/${var.stackSettings.azure_subscription_id}/resourceGroups/${var.stackSettings.azurerm_resource_group}/providers/Microsoft.Compute/virtualMachines/${azurerm_virtual_machine.main.id}"
                            },
                            "syslogEvents": { /** list of syslogs **/},
                            "performanceCounters": {/** list of perf counters **/}
                        },
                        "sampleRateInSeconds": 15
                    }
    }
    SETTINGS

  protected_settings = <<SETTINGS
    {
        "storageAccountName": "${var.stackSettings.azurerm_storage_account.name}",
        "storageAccountKey":  "${var.stackSettings.azurerm_storage_account.primary_access_key}",
        "storageAccountEndPoint": "https://core.windows.net"
    }
    SETTINGS

  depends_on = [azurerm_virtual_machine.main]
}

Every time I attempt to apply via terraform I receive the error:

Error: Code="VMExtensionProvisioningError" Message="VM has reported a failure when processing extension 'LinuxDiagnostic'. Error message: \"Extension operation Enable failed:'NoneType' object has no attribute 'get_fluentd_syslog_src_config'\"\r\n\r\nMore information on troubleshooting is available at https://aka.ms/VMExtensionLinuxDiagnosticsTroubleshoot "

  on ..\..\..\..\modules\Azure-Server\v1\main.tf line 284, in resource "azurerm_virtual_machine_extension" "diagnostics_linux":
 284: resource "azurerm_virtual_machine_extension" "diagnostics_linux" {

My windows diagnostic extension works fine and I took the JSON directly from a working deploy through the portal.

Looking for assistance as to what I could be missing. Or if someone has the XML LAD version, I would try that too (cannot find it anywhere).

Thanks!

EDIT

Full working solution (including getting the pesky SAS Token and reading from json files instead of giant terrform blocks!) Terraform Config:

/**
Linux Diagnostic Agent
The linux diagnostic agent is rather complicated to get working.
You need:
1. A static timestamp for start/expiry time
2. A SAS token from the storage account with custom permissions
3. Importing multiple large jsons with custom cleanup
This is taken care of for everything below
**/


//== Provider used to store timestamp SAS token lifetime ==//
provider "time" {
  version = "~> 0.4"
}

//== Store 10 years in the future ==//
resource "time_offset" "linux_oms_sas_expiry" {
  count = local.is_windows == true ? 0 : 1
  offset_years = 10
}

//== Store (now - 10) days to ensure we have valid SAS ==//
resource "time_offset" "linux_oms_sas_start" {
  count = local.is_windows == true ? 0 : 1
  offset_days = -10
}

//== SAS Token required for Diagnostic Extension ==//
/**
The permissions are based on the linux powershell sas creation here: https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/diagnostics-linux
**/
data "azurerm_storage_account_sas" "linux_oms" {
  count = local.is_windows == true ? 0 : 1
  connection_string = var.stackSettings.azurerm_storage_account.primary_connection_string
  https_only        = true

  resource_types {
    service   = true
    container = true
    object    = true
  }

  services {
    blob  = true
    table = true
    queue = false
    file = false
  }

  start  = time_offset.linux_oms_sas_start[0].rfc3339
  expiry = time_offset.linux_oms_sas_expiry[0].rfc3339

  permissions {
    read    = true
    write   = true
    delete  = true
    list    = true
    add     = true
    create  = true
    update  = true
    process = true
  }
}

//=== Install Diagnostic Extension ===//
resource "azurerm_virtual_machine_extension" "diagnostics_linux" {
  count                      = local.is_windows == true ? 0 : 1
  name                       = "LinuxDiagnostic"
  virtual_machine_id         =  azurerm_virtual_machine.main.id
  publisher                  = "Microsoft.Azure.Diagnostics"
  type                       = "LinuxDiagnostic"
  type_handler_version       = "3.0"
  auto_upgrade_minor_version = "true"

  settings = <<SETTINGS
    {
      "StorageAccount": "${var.stackSettings.azurerm_storage_account.name}",
      "ladCfg": {
          "diagnosticMonitorConfiguration": {
                "eventVolume": "Medium", 
                "metrics": {
                     "metricAggregation": [
                        {
                            "scheduledTransferPeriod": "PT1H"
                        }, 
                        {
                            "scheduledTransferPeriod": "PT1M"
                        }
                    ], 
                    "resourceId": "${azurerm_virtual_machine.main.id}"
                },
                "performanceCounters": ${file("${path.module}/azure_jsons/azure_extension_diagnostics_linux_performancecounters.json")},
                "syslogEvents": ${file("${path.module}/azure_jsons/azure_extension_diagnostics_linux_syslogevents.json")}
          }, 
          "sampleRateInSeconds": 15
      }
    }
  SETTINGS

  protected_settings = <<SETTINGS
    {
        "storageAccountName": "${var.stackSettings.azurerm_storage_account.name}",
        "storageAccountSasToken": "${data.azurerm_storage_account_sas.linux_oms[0].sas}",
        "storageAccountEndPoint": "https://core.windows.net",
         "sinksConfig":  {
              "sink": [
                {
                    "name": "SyslogJsonBlob",
                    "type": "JsonBlob"
                },
                {
                    "name": "LinuxCpuJsonBlob",
                    "type": "JsonBlob"
                }
              ]
        }
    }
    SETTINGS

  depends_on = [azurerm_virtual_machine.main]
}

azure_extension_diagnostics_linux_performancecounters.json :

{
    "performanceCounterConfiguration": [
        {
            "annotation": [
                {
                    "displayName": "Disk read guest OS",
                    "locale": "en-us"
                }
            ],
            "class": "disk",
            "condition": "IsAggregate=TRUE",
            "counter": "readbytespersecond",
            "counterSpecifier": "/builtin/disk/readbytespersecond",
            "type": "builtin",
            "unit": "BytesPerSecond"
        },
        {
            "annotation": [
                {
                    "displayName": "Disk writes",
                    "locale": "en-us"
                }
            ],
            "class": "disk",
            "condition": "IsAggregate=TRUE",
            "counter": "writespersecond",
            "counterSpecifier": "/builtin/disk/writespersecond",
            "type": "builtin",
            "unit": "CountPerSecond"
        },
        {
            "annotation": [
                {
                    "displayName": "Disk transfer time",
                    "locale": "en-us"
                }
            ],
            "class": "disk",
            "condition": "IsAggregate=TRUE",
            "counter": "averagetransfertime",
            "counterSpecifier": "/builtin/disk/averagetransfertime",
            "type": "builtin",
            "unit": "Seconds"
        },
        {
            "annotation": [
                {
                    "displayName": "Disk transfers",
                    "locale": "en-us"
                }
            ],
            "class": "disk",
            "condition": "IsAggregate=TRUE",
            "counter": "transferspersecond",
            "counterSpecifier": "/builtin/disk/transferspersecond",
            "type": "builtin",
            "unit": "CountPerSecond"
        },
        {
            "annotation": [
                {
                    "displayName": "Disk write guest OS",
                    "locale": "en-us"
                }
            ],
            "class": "disk",
            "condition": "IsAggregate=TRUE",
            "counter": "writebytespersecond",
            "counterSpecifier": "/builtin/disk/writebytespersecond",
            "type": "builtin",
            "unit": "BytesPerSecond"
        },
        {
            "annotation": [
                {
                    "displayName": "Disk read time",
                    "locale": "en-us"
                }
            ],
            "class": "disk",
            "condition": "IsAggregate=TRUE",
            "counter": "averagereadtime",
            "counterSpecifier": "/builtin/disk/averagereadtime",
            "type": "builtin",
            "unit": "Seconds"
        },
        {
            "annotation": [
                {
                    "displayName": "Disk write time",
                    "locale": "en-us"
                }
            ],
            "class": "disk",
            "condition": "IsAggregate=TRUE",
            "counter": "averagewritetime",
            "counterSpecifier": "/builtin/disk/averagewritetime",
            "type": "builtin",
            "unit": "Seconds"
        },
        {
            "annotation": [
                {
                    "displayName": "Disk total bytes",
                    "locale": "en-us"
                }
            ],
            "class": "disk",
            "condition": "IsAggregate=TRUE",
            "counter": "bytespersecond",
            "counterSpecifier": "/builtin/disk/bytespersecond",
            "type": "builtin",
            "unit": "BytesPerSecond"
        },
        {
            "annotation": [
                {
                    "displayName": "Disk reads",
                    "locale": "en-us"
                }
            ],
            "class": "disk",
            "condition": "IsAggregate=TRUE",
            "counter": "readspersecond",
            "counterSpecifier": "/builtin/disk/readspersecond",
            "type": "builtin",
            "unit": "CountPerSecond"
        },
        {
            "annotation": [
                {
                    "displayName": "Disk queue length",
                    "locale": "en-us"
                }
            ],
            "class": "disk",
            "condition": "IsAggregate=TRUE",
            "counter": "averagediskqueuelength",
            "counterSpecifier": "/builtin/disk/averagediskqueuelength",
            "type": "builtin",
            "unit": "Count"
        },
        {
            "annotation": [
                {
                    "displayName": "Network in guest OS",
                    "locale": "en-us"
                }
            ],
            "class": "network",
            "counter": "bytesreceived",
            "counterSpecifier": "/builtin/network/bytesreceived",
            "type": "builtin",
            "unit": "Bytes"
        },
        {
            "annotation": [
                {
                    "displayName": "Network total bytes",
                    "locale": "en-us"
                }
            ],
            "class": "network",
            "counter": "bytestotal",
            "counterSpecifier": "/builtin/network/bytestotal",
            "type": "builtin",
            "unit": "Bytes"
        },
        {
            "annotation": [
                {
                    "displayName": "Network out guest OS",
                    "locale": "en-us"
                }
            ],
            "class": "network",
            "counter": "bytestransmitted",
            "counterSpecifier": "/builtin/network/bytestransmitted",
            "type": "builtin",
            "unit": "Bytes"
        },
        {
            "annotation": [
                {
                    "displayName": "Network collisions",
                    "locale": "en-us"
                }
            ],
            "class": "network",
            "counter": "totalcollisions",
            "counterSpecifier": "/builtin/network/totalcollisions",
            "type": "builtin",
            "unit": "Count"
        },
        {
            "annotation": [
                {
                    "displayName": "Packets received errors",
                    "locale": "en-us"
                }
            ],
            "class": "network",
            "counter": "totalrxerrors",
            "counterSpecifier": "/builtin/network/totalrxerrors",
            "type": "builtin",
            "unit": "Count"
        },
        {
            "annotation": [
                {
                    "displayName": "Packets sent",
                    "locale": "en-us"
                }
            ],
            "class": "network",
            "counter": "packetstransmitted",
            "counterSpecifier": "/builtin/network/packetstransmitted",
            "type": "builtin",
            "unit": "Count"
        },
        {
            "annotation": [
                {
                    "displayName": "Packets received",
                    "locale": "en-us"
                }
            ],
            "class": "network",
            "counter": "packetsreceived",
            "counterSpecifier": "/builtin/network/packetsreceived",
            "type": "builtin",
            "unit": "Count"
        },
        {
            "annotation": [
                {
                    "displayName": "Packets sent errors",
                    "locale": "en-us"
                }
            ],
            "class": "network",
            "counter": "totaltxerrors",
            "counterSpecifier": "/builtin/network/totaltxerrors",
            "type": "builtin",
            "unit": "Count"
        },
        {
            "annotation": [
                {
                    "displayName": "Filesystem transfers/sec",
                    "locale": "en-us"
                }
            ],
            "class": "filesystem",
            "condition": "IsAggregate=TRUE",
            "counter": "transferspersecond",
            "counterSpecifier": "/builtin/filesystem/transferspersecond",
            "type": "builtin",
            "unit": "CountPerSecond"
        },
        {
            "annotation": [
                {
                    "displayName": "Filesystem % free space",
                    "locale": "en-us"
                }
            ],
            "class": "filesystem",
            "condition": "IsAggregate=TRUE",
            "counter": "percentfreespace",
            "counterSpecifier": "/builtin/filesystem/percentfreespace",
            "type": "builtin",
            "unit": "Percent"
        },
        {
            "annotation": [
                {
                    "displayName": "Filesystem % used space",
                    "locale": "en-us"
                }
            ],
            "class": "filesystem",
            "condition": "IsAggregate=TRUE",
            "counter": "percentusedspace",
            "counterSpecifier": "/builtin/filesystem/percentusedspace",
            "type": "builtin",
            "unit": "Percent"
        },
        {
            "annotation": [
                {
                    "displayName": "Filesystem used space",
                    "locale": "en-us"
                }
            ],
            "class": "filesystem",
            "condition": "IsAggregate=TRUE",
            "counter": "usedspace",
            "counterSpecifier": "/builtin/filesystem/usedspace",
            "type": "builtin",
            "unit": "Bytes"
        },
        {
            "annotation": [
                {
                    "displayName": "Filesystem read bytes/sec",
                    "locale": "en-us"
                }
            ],
            "class": "filesystem",
            "condition": "IsAggregate=TRUE",
            "counter": "bytesreadpersecond",
            "counterSpecifier": "/builtin/filesystem/bytesreadpersecond",
            "type": "builtin",
            "unit": "CountPerSecond"
        },
        {
            "annotation": [
                {
                    "displayName": "Filesystem free space",
                    "locale": "en-us"
                }
            ],
            "class": "filesystem",
            "condition": "IsAggregate=TRUE",
            "counter": "freespace",
            "counterSpecifier": "/builtin/filesystem/freespace",
            "type": "builtin",
            "unit": "Bytes"
        },
        {
            "annotation": [
                {
                    "displayName": "Filesystem % free inodes",
                    "locale": "en-us"
                }
            ],
            "class": "filesystem",
            "condition": "IsAggregate=TRUE",
            "counter": "percentfreeinodes",
            "counterSpecifier": "/builtin/filesystem/percentfreeinodes",
            "type": "builtin",
            "unit": "Percent"
        },
        {
            "annotation": [
                {
                    "displayName": "Filesystem bytes/sec",
                    "locale": "en-us"
                }
            ],
            "class": "filesystem",
            "condition": "IsAggregate=TRUE",
            "counter": "bytespersecond",
            "counterSpecifier": "/builtin/filesystem/bytespersecond",
            "type": "builtin",
            "unit": "BytesPerSecond"
        },
        {
            "annotation": [
                {
                    "displayName": "Filesystem reads/sec",
                    "locale": "en-us"
                }
            ],
            "class": "filesystem",
            "condition": "IsAggregate=TRUE",
            "counter": "readspersecond",
            "counterSpecifier": "/builtin/filesystem/readspersecond",
            "type": "builtin",
            "unit": "CountPerSecond"
        },
        {
            "annotation": [
                {
                    "displayName": "Filesystem write bytes/sec",
                    "locale": "en-us"
                }
            ],
            "class": "filesystem",
            "condition": "IsAggregate=TRUE",
            "counter": "byteswrittenpersecond",
            "counterSpecifier": "/builtin/filesystem/byteswrittenpersecond",
            "type": "builtin",
            "unit": "CountPerSecond"
        },
        {
            "annotation": [
                {
                    "displayName": "Filesystem writes/sec",
                    "locale": "en-us"
                }
            ],
            "class": "filesystem",
            "condition": "IsAggregate=TRUE",
            "counter": "writespersecond",
            "counterSpecifier": "/builtin/filesystem/writespersecond",
            "type": "builtin",
            "unit": "CountPerSecond"
        },
        {
            "annotation": [
                {
                    "displayName": "Filesystem % used inodes",
                    "locale": "en-us"
                }
            ],
            "class": "filesystem",
            "condition": "IsAggregate=TRUE",
            "counter": "percentusedinodes",
            "counterSpecifier": "/builtin/filesystem/percentusedinodes",
            "type": "builtin",
            "unit": "Percent"
        },
        {
            "annotation": [
                {
                    "displayName": "CPU IO wait time",
                    "locale": "en-us"
                }
            ],
            "class": "processor",
            "condition": "IsAggregate=TRUE",
            "counter": "percentiowaittime",
            "counterSpecifier": "/builtin/processor/percentiowaittime",
            "type": "builtin",
            "unit": "Percent"
        },
        {
            "annotation": [
                {
                    "displayName": "CPU user time",
                    "locale": "en-us"
                }
            ],
            "class": "processor",
            "condition": "IsAggregate=TRUE",
            "counter": "percentusertime",
            "counterSpecifier": "/builtin/processor/percentusertime",
            "type": "builtin",
            "unit": "Percent"
        },
        {
            "annotation": [
                {
                    "displayName": "CPU nice time",
                    "locale": "en-us"
                }
            ],
            "class": "processor",
            "condition": "IsAggregate=TRUE",
            "counter": "percentnicetime",
            "counterSpecifier": "/builtin/processor/percentnicetime",
            "type": "builtin",
            "unit": "Percent"
        },
        {
            "annotation": [
                {
                    "displayName": "CPU percentage guest OS",
                    "locale": "en-us"
                }
            ],
            "class": "processor",
            "condition": "IsAggregate=TRUE",
            "counter": "percentprocessortime",
            "counterSpecifier": "/builtin/processor/percentprocessortime",
            "type": "builtin",
            "unit": "Percent"
        },
        {
            "annotation": [
                {
                    "displayName": "CPU interrupt time",
                    "locale": "en-us"
                }
            ],
            "class": "processor",
            "condition": "IsAggregate=TRUE",
            "counter": "percentinterrupttime",
            "counterSpecifier": "/builtin/processor/percentinterrupttime",
            "type": "builtin",
            "unit": "Percent"
        },
        {
            "annotation": [
                {
                    "displayName": "CPU idle time",
                    "locale": "en-us"
                }
            ],
            "class": "processor",
            "condition": "IsAggregate=TRUE",
            "counter": "percentidletime",
            "counterSpecifier": "/builtin/processor/percentidletime",
            "type": "builtin",
            "unit": "Percent"
        },
        {
            "annotation": [
                {
                    "displayName": "CPU privileged time",
                    "locale": "en-us"
                }
            ],
            "class": "processor",
            "condition": "IsAggregate=TRUE",
            "counter": "percentprivilegedtime",
            "counterSpecifier": "/builtin/processor/percentprivilegedtime",
            "type": "builtin",
            "unit": "Percent"
        },
        {
            "annotation": [
                {
                    "displayName": "Memory available",
                    "locale": "en-us"
                }
            ],
            "class": "memory",
            "counter": "availablememory",
            "counterSpecifier": "/builtin/memory/availablememory",
            "type": "builtin",
            "unit": "Bytes"
        },
        {
            "annotation": [
                {
                    "displayName": "Swap percent used",
                    "locale": "en-us"
                }
            ],
            "class": "memory",
            "counter": "percentusedswap",
            "counterSpecifier": "/builtin/memory/percentusedswap",
            "type": "builtin",
            "unit": "Percent"
        },
        {
            "annotation": [
                {
                    "displayName": "Memory used",
                    "locale": "en-us"
                }
            ],
            "class": "memory",
            "counter": "usedmemory",
            "counterSpecifier": "/builtin/memory/usedmemory",
            "type": "builtin",
            "unit": "Bytes"
        },
        {
            "annotation": [
                {
                    "displayName": "Page reads",
                    "locale": "en-us"
                }
            ],
            "class": "memory",
            "counter": "pagesreadpersec",
            "counterSpecifier": "/builtin/memory/pagesreadpersec",
            "type": "builtin",
            "unit": "CountPerSecond"
        },
        {
            "annotation": [
                {
                    "displayName": "Swap available",
                    "locale": "en-us"
                }
            ],
            "class": "memory",
            "counter": "availableswap",
            "counterSpecifier": "/builtin/memory/availableswap",
            "type": "builtin",
            "unit": "Bytes"
        },
        {
            "annotation": [
                {
                    "displayName": "Swap percent available",
                    "locale": "en-us"
                }
            ],
            "class": "memory",
            "counter": "percentavailableswap",
            "counterSpecifier": "/builtin/memory/percentavailableswap",
            "type": "builtin",
            "unit": "Percent"
        },
        {
            "annotation": [
                {
                    "displayName": "Mem. percent available",
                    "locale": "en-us"
                }
            ],
            "class": "memory",
            "counter": "percentavailablememory",
            "counterSpecifier": "/builtin/memory/percentavailablememory",
            "type": "builtin",
            "unit": "Percent"
        },
        {
            "annotation": [
                {
                    "displayName": "Pages",
                    "locale": "en-us"
                }
            ],
            "class": "memory",
            "counter": "pagespersec",
            "counterSpecifier": "/builtin/memory/pagespersec",
            "type": "builtin",
            "unit": "CountPerSecond"
        },
        {
            "annotation": [
                {
                    "displayName": "Swap used",
                    "locale": "en-us"
                }
            ],
            "class": "memory",
            "counter": "usedswap",
            "counterSpecifier": "/builtin/memory/usedswap",
            "type": "builtin",
            "unit": "Bytes"
        },
        {
            "annotation": [
                {
                    "displayName": "Memory percentage",
                    "locale": "en-us"
                }
            ],
            "class": "memory",
            "counter": "percentusedmemory",
            "counterSpecifier": "/builtin/memory/percentusedmemory",
            "type": "builtin",
            "unit": "Percent"
        },
        {
            "annotation": [
                {
                    "displayName": "Page writes",
                    "locale": "en-us"
                }
            ],
            "class": "memory",
            "counter": "pageswrittenpersec",
            "counterSpecifier": "/builtin/memory/pageswrittenpersec",
            "type": "builtin",
            "unit": "CountPerSecond"
        }
    ]
}

azure_extension_diagnostics_linux_syslogevents.json

{
    "syslogEventConfiguration": {
        "LOG_AUTH": "LOG_DEBUG",
        "LOG_AUTHPRIV": "LOG_DEBUG",
        "LOG_CRON": "LOG_DEBUG",
        "LOG_DAEMON": "LOG_DEBUG",
        "LOG_FTP": "LOG_DEBUG",
        "LOG_KERN": "LOG_DEBUG",
        "LOG_LOCAL0": "LOG_DEBUG",
        "LOG_LOCAL1": "LOG_DEBUG",
        "LOG_LOCAL2": "LOG_DEBUG",
        "LOG_LOCAL3": "LOG_DEBUG",
        "LOG_LOCAL4": "LOG_DEBUG",
        "LOG_LOCAL5": "LOG_DEBUG",
        "LOG_LOCAL6": "LOG_DEBUG",
        "LOG_LOCAL7": "LOG_DEBUG",
        "LOG_LPR": "LOG_DEBUG",
        "LOG_MAIL": "LOG_DEBUG",
        "LOG_NEWS": "LOG_DEBUG",
        "LOG_SYSLOG": "LOG_DEBUG",
        "LOG_USER": "LOG_DEBUG",
        "LOG_UUCP": "LOG_DEBUG"
    }
}

EDIT 2

Ready to go module if needed: https://github.com/elongstreet88/terraform-linuxdiagnostic-agent-module

解决方案

AS pointed out above you need to add sas token for storage account, output this storage account SAS token using terraform an then input this in the protected settings that way ( I will copy-past my full config to help.... ) :

                resource "azurerm_virtual_machine_extension" "nva1_diag_setting" {
                 name                 = "${var.current-name-convention-core-module}-nva1-ub16-LinuxDiagnostics"
                 virtual_machine_id = "${azurerm_virtual_machine.nva1-ub16.id}"
                 publisher                     = "Microsoft.Azure.Diagnostics"
                 type                          = "LinuxDiagnostic"
                 type_handler_version          = "3.0"
                 auto_upgrade_minor_version    = "true"

                  settings = <<SETTINGS
                        {
                        "StorageAccount": "${var.stor-log-repo-name}",
                        "ladCfg": {
                            "diagnosticMonitorConfiguration": {
                            "eventVolume": "Medium", 
                            "metrics": {
                                "metricAggregation": [
                                {
                                    "scheduledTransferPeriod": "PT1H"
                                }, 
                                {
                                    "scheduledTransferPeriod": "PT1M"
                                }
                                ], 
                                "resourceId": "${azurerm_virtual_machine.nva1-ub16.id}"
                            }, 
                            "performanceCounters": {
                                "performanceCounterConfiguration": [
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Disk read guest OS", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "disk", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "readbytespersecond", 
                                    "counterSpecifier": "/builtin/disk/readbytespersecond", 
                                    "type": "builtin", 
                                    "unit": "BytesPerSecond"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Disk writes", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "disk", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "writespersecond", 
                                    "counterSpecifier": "/builtin/disk/writespersecond", 
                                    "type": "builtin", 
                                    "unit": "CountPerSecond"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Disk transfer time", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "disk", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "averagetransfertime", 
                                    "counterSpecifier": "/builtin/disk/averagetransfertime", 
                                    "type": "builtin", 
                                    "unit": "Seconds"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Disk transfers", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "disk", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "transferspersecond", 
                                    "counterSpecifier": "/builtin/disk/transferspersecond", 
                                    "type": "builtin", 
                                    "unit": "CountPerSecond"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Disk write guest OS", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "disk", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "writebytespersecond", 
                                    "counterSpecifier": "/builtin/disk/writebytespersecond", 
                                    "type": "builtin", 
                                    "unit": "BytesPerSecond"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Disk read time", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "disk", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "averagereadtime", 
                                    "counterSpecifier": "/builtin/disk/averagereadtime", 
                                    "type": "builtin", 
                                    "unit": "Seconds"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Disk write time", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "disk", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "averagewritetime", 
                                    "counterSpecifier": "/builtin/disk/averagewritetime", 
                                    "type": "builtin", 
                                    "unit": "Seconds"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Disk total bytes", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "disk", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "bytespersecond", 
                                    "counterSpecifier": "/builtin/disk/bytespersecond", 
                                    "type": "builtin", 
                                    "unit": "BytesPerSecond"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Disk reads", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "disk", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "readspersecond", 
                                    "counterSpecifier": "/builtin/disk/readspersecond", 
                                    "type": "builtin", 
                                    "unit": "CountPerSecond"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Disk queue length", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "disk", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "averagediskqueuelength", 
                                    "counterSpecifier": "/builtin/disk/averagediskqueuelength", 
                                    "type": "builtin", 
                                    "unit": "Count"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Network in guest OS", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "network", 
                                    "counter": "bytesreceived", 
                                    "counterSpecifier": "/builtin/network/bytesreceived", 
                                    "type": "builtin", 
                                    "unit": "Bytes"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Network total bytes", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "network", 
                                    "counter": "bytestotal", 
                                    "counterSpecifier": "/builtin/network/bytestotal", 
                                    "type": "builtin", 
                                    "unit": "Bytes"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Network out guest OS", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "network", 
                                    "counter": "bytestransmitted", 
                                    "counterSpecifier": "/builtin/network/bytestransmitted", 
                                    "type": "builtin", 
                                    "unit": "Bytes"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Network collisions", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "network", 
                                    "counter": "totalcollisions", 
                                    "counterSpecifier": "/builtin/network/totalcollisions", 
                                    "type": "builtin", 
                                    "unit": "Count"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Packets received errors", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "network", 
                                    "counter": "totalrxerrors", 
                                    "counterSpecifier": "/builtin/network/totalrxerrors", 
                                    "type": "builtin", 
                                    "unit": "Count"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Packets sent", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "network", 
                                    "counter": "packetstransmitted", 
                                    "counterSpecifier": "/builtin/network/packetstransmitted", 
                                    "type": "builtin", 
                                    "unit": "Count"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Packets received", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "network", 
                                    "counter": "packetsreceived", 
                                    "counterSpecifier": "/builtin/network/packetsreceived", 
                                    "type": "builtin", 
                                    "unit": "Count"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Packets sent errors", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "network", 
                                    "counter": "totaltxerrors", 
                                    "counterSpecifier": "/builtin/network/totaltxerrors", 
                                    "type": "builtin", 
                                    "unit": "Count"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Filesystem transfers/sec", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "filesystem", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "transferspersecond", 
                                    "counterSpecifier": "/builtin/filesystem/transferspersecond", 
                                    "type": "builtin", 
                                    "unit": "CountPerSecond"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Filesystem % free space", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "filesystem", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "percentfreespace", 
                                    "counterSpecifier": "/builtin/filesystem/percentfreespace", 
                                    "type": "builtin", 
                                    "unit": "Percent"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Filesystem % used space", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "filesystem", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "percentusedspace", 
                                    "counterSpecifier": "/builtin/filesystem/percentusedspace", 
                                    "type": "builtin", 
                                    "unit": "Percent"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Filesystem used space", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "filesystem", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "usedspace", 
                                    "counterSpecifier": "/builtin/filesystem/usedspace", 
                                    "type": "builtin", 
                                    "unit": "Bytes"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Filesystem read bytes/sec", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "filesystem", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "bytesreadpersecond", 
                                    "counterSpecifier": "/builtin/filesystem/bytesreadpersecond", 
                                    "type": "builtin", 
                                    "unit": "CountPerSecond"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Filesystem free space", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "filesystem", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "freespace", 
                                    "counterSpecifier": "/builtin/filesystem/freespace", 
                                    "type": "builtin", 
                                    "unit": "Bytes"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Filesystem % free inodes", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "filesystem", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "percentfreeinodes", 
                                    "counterSpecifier": "/builtin/filesystem/percentfreeinodes", 
                                    "type": "builtin", 
                                    "unit": "Percent"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Filesystem bytes/sec", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "filesystem", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "bytespersecond", 
                                    "counterSpecifier": "/builtin/filesystem/bytespersecond", 
                                    "type": "builtin", 
                                    "unit": "BytesPerSecond"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Filesystem reads/sec", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "filesystem", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "readspersecond", 
                                    "counterSpecifier": "/builtin/filesystem/readspersecond", 
                                    "type": "builtin", 
                                    "unit": "CountPerSecond"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Filesystem write bytes/sec", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "filesystem", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "byteswrittenpersecond", 
                                    "counterSpecifier": "/builtin/filesystem/byteswrittenpersecond", 
                                    "type": "builtin", 
                                    "unit": "CountPerSecond"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Filesystem writes/sec", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "filesystem", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "writespersecond", 
                                    "counterSpecifier": "/builtin/filesystem/writespersecond", 
                                    "type": "builtin", 
                                    "unit": "CountPerSecond"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Filesystem % used inodes", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "filesystem", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "percentusedinodes", 
                                    "counterSpecifier": "/builtin/filesystem/percentusedinodes", 
                                    "type": "builtin", 
                                    "unit": "Percent"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "CPU IO wait time", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "processor", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "percentiowaittime", 
                                    "counterSpecifier": "/builtin/processor/percentiowaittime", 
                                    "type": "builtin", 
                                    "unit": "Percent"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "CPU user time", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "processor", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "percentusertime", 
                                    "counterSpecifier": "/builtin/processor/percentusertime", 
                                    "type": "builtin", 
                                    "unit": "Percent"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "CPU nice time", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "processor", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "percentnicetime", 
                                    "counterSpecifier": "/builtin/processor/percentnicetime", 
                                    "type": "builtin", 
                                    "unit": "Percent"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "CPU percentage guest OS", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "processor", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "percentprocessortime", 
                                    "counterSpecifier": "/builtin/processor/percentprocessortime", 
                                    "type": "builtin", 
                                    "unit": "Percent"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "CPU interrupt time", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "processor", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "percentinterrupttime", 
                                    "counterSpecifier": "/builtin/processor/percentinterrupttime", 
                                    "type": "builtin", 
                                    "unit": "Percent"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "CPU idle time", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "processor", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "percentidletime", 
                                    "counterSpecifier": "/builtin/processor/percentidletime", 
                                    "type": "builtin", 
                                    "unit": "Percent"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "CPU privileged time", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "processor", 
                                    "condition": "IsAggregate=TRUE", 
                                    "counter": "percentprivilegedtime", 
                                    "counterSpecifier": "/builtin/processor/percentprivilegedtime", 
                                    "type": "builtin", 
                                    "unit": "Percent"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Memory available", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "memory", 
                                    "counter": "availablememory", 
                                    "counterSpecifier": "/builtin/memory/availablememory", 
                                    "type": "builtin", 
                                    "unit": "Bytes"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Swap percent used", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "memory", 
                                    "counter": "percentusedswap", 
                                    "counterSpecifier": "/builtin/memory/percentusedswap", 
                                    "type": "builtin", 
                                    "unit": "Percent"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Memory used", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "memory", 
                                    "counter": "usedmemory", 
                                    "counterSpecifier": "/builtin/memory/usedmemory", 
                                    "type": "builtin", 
                                    "unit": "Bytes"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Page reads", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "memory", 
                                    "counter": "pagesreadpersec", 
                                    "counterSpecifier": "/builtin/memory/pagesreadpersec", 
                                    "type": "builtin", 
                                    "unit": "CountPerSecond"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Swap available", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "memory", 
                                    "counter": "availableswap", 
                                    "counterSpecifier": "/builtin/memory/availableswap", 
                                    "type": "builtin", 
                                    "unit": "Bytes"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Swap percent available", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "memory", 
                                    "counter": "percentavailableswap", 
                                    "counterSpecifier": "/builtin/memory/percentavailableswap", 
                                    "type": "builtin", 
                                    "unit": "Percent"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Mem. percent available", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "memory", 
                                    "counter": "percentavailablememory", 
                                    "counterSpecifier": "/builtin/memory/percentavailablememory", 
                                    "type": "builtin", 
                                    "unit": "Percent"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Pages", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "memory", 
                                    "counter": "pagespersec", 
                                    "counterSpecifier": "/builtin/memory/pagespersec", 
                                    "type": "builtin", 
                                    "unit": "CountPerSecond"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Swap used", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "memory", 
                                    "counter": "usedswap", 
                                    "counterSpecifier": "/builtin/memory/usedswap", 
                                    "type": "builtin", 
                                    "unit": "Bytes"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Memory percentage", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "memory", 
                                    "counter": "percentusedmemory", 
                                    "counterSpecifier": "/builtin/memory/percentusedmemory", 
                                    "type": "builtin", 
                                    "unit": "Percent"
                                }, 
                                {
                                    "annotation": [
                                    {
                                        "displayName": "Page writes", 
                                        "locale": "en-us"
                                    }
                                    ], 
                                    "class": "memory", 
                                    "counter": "pageswrittenpersec", 
                                    "counterSpecifier": "/builtin/memory/pageswrittenpersec", 
                                    "type": "builtin", 
                                    "unit": "CountPerSecond"
                                }
                                ]
                            }, 
                            "syslogEvents": {
                                "syslogEventConfiguration": {
                                "LOG_AUTH": "LOG_DEBUG", 
                                "LOG_AUTHPRIV": "LOG_DEBUG", 
                                "LOG_CRON": "LOG_DEBUG", 
                                "LOG_DAEMON": "LOG_DEBUG", 
                                "LOG_FTP": "LOG_DEBUG", 
                                "LOG_KERN": "LOG_DEBUG", 
                                "LOG_LOCAL0": "LOG_DEBUG", 
                                "LOG_LOCAL1": "LOG_DEBUG", 
                                "LOG_LOCAL2": "LOG_DEBUG", 
                                "LOG_LOCAL3": "LOG_DEBUG", 
                                "LOG_LOCAL4": "LOG_DEBUG", 
                                "LOG_LOCAL5": "LOG_DEBUG", 
                                "LOG_LOCAL6": "LOG_DEBUG", 
                                "LOG_LOCAL7": "LOG_DEBUG", 
                                "LOG_LPR": "LOG_DEBUG", 
                                "LOG_MAIL": "LOG_DEBUG", 
                                "LOG_NEWS": "LOG_DEBUG", 
                                "LOG_SYSLOG": "LOG_DEBUG", 
                                "LOG_USER": "LOG_DEBUG", 
                                "LOG_UUCP": "LOG_DEBUG"
                                }
                            }
                            }, 
                            "sampleRateInSeconds": 15
                        }
                        }


                SETTINGS

                  protected_settings = <<PROTECTED_SETTINGS
                {
                  "storageAccountName": "${var.stor-log-repo-name}",
                  "storageAccountSasToken": "${var.stor-log-repo-sas}",
                  "sinksConfig": 
                      {
                        "sink": [
                          {
                              "name": "SyslogJsonBlob",
                              "type": "JsonBlob"
                          },
                          {
                              "name": "LinuxCpuJsonBlob",
                              "type": "JsonBlob"
                          }
                        ]
                  }
                }


                PROTECTED_SETTINGS
                }

Then you will have this kind of data in your storage account :

As we speak, Terraform does not support SAS token ( yet ) for Azure EVent hub ( only for azure storage for now ) , so we cannot use terraform to do that, I opened a github issue, let's see if this is going to be added.

这篇关于尝试通过Terraform添加LinuxDiagnostic Azure VM Extension并获取错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆