你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Tables - Create Or Update

更新或创建 Log Analytics 工作区表。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/tables/{tableName}?api-version=2025-07-01

URI 参数

名称 必需 类型 说明
resourceGroupName
path True

string

minLength: 1
maxLength: 90

资源组的名称。 此名称不区分大小写。

subscriptionId
path True

string

minLength: 1

目标订阅的 ID。

tableName
path True

string

minLength: 4
maxLength: 63
pattern: ^[A-Za-z0-9-_]+$

表的名称。

workspaceName
path True

string

minLength: 4
maxLength: 63
pattern: ^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$

工作区的名称。

api-version
query True

string

minLength: 1

要用于此操作的 API 版本。

请求正文

名称 类型 说明
properties.plan

TablePlanEnum

指示系统如何处理和收费引入到此表的日志。

properties.restoredLogs

RestoredLogs

启动此表的还原作的参数。

properties.retentionInDays

integer (int32)

minimum: 4
maximum: 730

在分析表中:表中的分析保留期(以天为单位),介于 4 到 730 之间。 将此属性设置为 -1 默认为工作区保留期。 在基本表和辅助表中:只读属性。

properties.schema

Schema

表架构。

properties.searchResults

SearchResults

启动此表的搜索作业的参数。

properties.totalRetentionInDays

integer (int32)

minimum: 4
maximum: 4383

表总保留期(以天为单位,介于 4 到 4383 之间)。 将此属性设置为 -1 将默认为 retentionInDays。

响应

名称 类型 说明
200 OK

Table

确定响应定义。

202 Accepted

接受的响应定义(长时间运行作)。

Other Status Codes

ErrorResponse

描述操作失败的原因的错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 流

类型: oauth2
流向: implicit
授权 URL: https://login.microsoftonline.com/common/oauth2/authorize

作用域

名称 说明
user_impersonation 模拟用户帐户

示例

TablesUpsert

示例请求

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/oiautorest6685/providers/Microsoft.OperationalInsights/workspaces/oiautorest6685/tables/AzureNetworkFlow?api-version=2025-07-01

{
  "properties": {
    "schema": {
      "name": "AzureNetworkFlow",
      "columns": [
        {
          "name": "MyNewColumn",
          "type": "guid"
        }
      ]
    },
    "retentionInDays": 45,
    "totalRetentionInDays": 70
  }
}

示例响应

{
  "properties": {
    "schema": {
      "name": "AzureNetworkFlow",
      "tableSubType": "DataCollectionRuleBased",
      "tableType": "Microsoft",
      "columns": [
        {
          "isHidden": false,
          "name": "MyNewColumn",
          "type": "guid",
          "isDefaultDisplay": false
        }
      ],
      "standardColumns": [
        {
          "isHidden": true,
          "name": "TenantId",
          "type": "guid",
          "isDefaultDisplay": false
        },
        {
          "isHidden": false,
          "name": "SourceSystem",
          "type": "string",
          "isDefaultDisplay": false
        },
        {
          "isHidden": false,
          "name": "TimeGenerated",
          "type": "dateTime",
          "isDefaultDisplay": false
        },
        {
          "isHidden": false,
          "name": "AgentID",
          "type": "string",
          "isDefaultDisplay": false
        },
        {
          "isHidden": false,
          "name": "SourceIP",
          "type": "string",
          "isDefaultDisplay": false
        },
        {
          "isHidden": false,
          "name": "Protocol",
          "type": "string",
          "isDefaultDisplay": false
        },
        {
          "isHidden": false,
          "name": "SourcePort",
          "type": "int",
          "isDefaultDisplay": false
        },
        {
          "isHidden": false,
          "name": "DestinationPort",
          "type": "int",
          "isDefaultDisplay": false
        },
        {
          "isHidden": false,
          "name": "TcpFlags",
          "type": "int",
          "isDefaultDisplay": false
        },
        {
          "isHidden": false,
          "name": "Packets",
          "type": "int",
          "isDefaultDisplay": false
        },
        {
          "isHidden": false,
          "name": "Bytes",
          "type": "int",
          "isDefaultDisplay": false
        },
        {
          "isHidden": false,
          "name": "BytesOut",
          "type": "int",
          "isDefaultDisplay": false
        },
        {
          "isHidden": false,
          "name": "DurationInMs",
          "type": "int",
          "isDefaultDisplay": false
        },
        {
          "isHidden": false,
          "name": "RstCount",
          "type": "int",
          "isDefaultDisplay": false
        },
        {
          "isHidden": false,
          "name": "MaxSampleRtt",
          "type": "int",
          "isDefaultDisplay": false
        }
      ],
      "solutions": [
        "LogManagement"
      ]
    },
    "provisioningState": "Succeeded",
    "retentionInDays": 45,
    "totalRetentionInDays": 70,
    "archiveRetentionInDays": 25,
    "retentionInDaysAsDefault": false,
    "totalRetentionInDaysAsDefault": false,
    "plan": "Analytics"
  },
  "id": "/subscriptions/00000000-0000-0000-0000-00000000000/resourcegroups/oiautorest6685/providers/Microsoft.OperationalInsights/workspaces/oiautorest6685/tables/AzureNetworkFlow",
  "name": "AzureNetworkFlow"
}
azure-asyncoperation: https://management.azure.com/subscriptions/00000000-0000-0000-0000-00000000000/providers/Microsoft.OperaitonalInsights/locations/eastus/operationstatuses/62e4d893-d233-4005-988e-a428d9f77076?api-version=2025-07-01
Location: https://management.azure.com/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/oiautorest6685/providers/Microsoft.OperaitonalInsights/workspaces/oiautorest6685/tables/table1_CL/operationresults/62e4d893-d233-4005-988e-a428d9f77076?api-version=2025-07-01

定义

名称 说明
Column

表列。

ColumnDataTypeHintEnum

列数据类型逻辑提示。

ColumnTypeEnum

列数据类型。

createdByType

创建资源的标识的类型。

ErrorAdditionalInfo

资源管理错误附加信息。

ErrorDetail

错误详细信息。

ErrorResponse

错误响应

ProvisioningStateEnum

表的当前预配状态。 如果设置为“更新”,则表示由于正在进行的作而导致的资源锁定,在正在进行的作结束之前禁止对表进行任何更新。

RestoredLogs

还原参数。

ResultStatistics

搜索作业执行统计信息。

Schema

表的架构。

SearchResults

启动此表的搜索作业的参数。

SourceEnum

表的创建者。

systemData

与创建和上次修改资源相关的元数据。

Table

工作区数据表定义。

TablePlanEnum

指示系统如何处理和收费引入到此表的日志。

TableSubTypeEnum

子类型描述了哪些 API 可用于与表交互,以及可用于表的功能。

TableTypeEnum

表的创建者。

Column

表列。

名称 类型 说明
dataTypeHint

ColumnDataTypeHintEnum

列数据类型逻辑提示。

description

string

列说明。

displayName

string

列显示名称。

isDefaultDisplay

boolean

默认显示。

isHidden

boolean

列是否隐藏。

name

string

列名。

type

ColumnTypeEnum

列数据类型。

ColumnDataTypeHintEnum

列数据类型逻辑提示。

说明
uri

与 URI 模式匹配的字符串,例如 scheme://username:password@host:1234/this/is/a/path?k1=v1&k2=v2#fragment

guid

遵循标准形状 xxxxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx 的标准 128 位 GUID

armPath

Azure 资源模型 (ARM) 路径:/subscriptions/{...}/resourceGroups/{...}/providers/Microsoft 中。{...}/{...}/{...}/{...}...

ip

遵循标准形状的标准 V4/V6 IP 地址 x.x.x.x/y:y:y:y:y:y:y:y

ColumnTypeEnum

列数据类型。

说明
string
int
long
real
boolean
dateTime
guid
dynamic

createdByType

创建资源的标识的类型。

说明
User
Application
ManagedIdentity
Key

ErrorAdditionalInfo

资源管理错误附加信息。

名称 类型 说明
info

object

其他信息。

type

string

其他信息类型。

ErrorDetail

错误详细信息。

名称 类型 说明
additionalInfo

ErrorAdditionalInfo[]

错误附加信息。

code

string

错误代码。

details

ErrorDetail[]

错误详细信息。

message

string

错误消息。

target

string

错误目标。

ErrorResponse

错误响应

名称 类型 说明
error

ErrorDetail

错误对象。

ProvisioningStateEnum

表的当前预配状态。 如果设置为“更新”,则表示由于正在进行的作而导致的资源锁定,在正在进行的作结束之前禁止对表进行任何更新。

说明
Updating

表模式仍在构建和更新中,表当前被锁定以进行任何更改,直到该过程完成。

InProgress

表模式稳定,没有更改,表数据正在更新。

Succeeded

表状态稳定且没有更改,表已解锁并开放以进行新更新。

Deleting

表状态正在删除。

RestoredLogs

还原参数。

名称 类型 说明
azureAsyncOperationId

string

搜索结果表异步作 ID。

endRestoreTime

string (date-time)

结束还原的时间戳(UTC)。

sourceTable

string

要从中还原数据的表。

startRestoreTime

string (date-time)

从 (UTC) 开始还原的时间戳。

ResultStatistics

搜索作业执行统计信息。

名称 类型 说明
ingestedRecords

integer (int32)

搜索作业返回的行数。

progress

number

multipleOf: 0.01

搜索作业完成百分比。

scannedGb

number

multipleOf: 0.01

搜索作业:扫描的数据量。

Schema

表的架构。

名称 类型 说明
categories

string[]

表类别。

columns

Column[]

表自定义列的列表。

description

string

表说明。

displayName

string

表显示名称。

labels

string[]

表标签。

name

string

表名。

solutions

string[]

该表所属的解决方案列表

source

SourceEnum

表的创建者。

standardColumns

Column[]

表标准列的列表。

tableSubType

TableSubTypeEnum

子类型描述了哪些 API 可用于与表交互,以及可用于表的功能。

tableType

TableTypeEnum

表的创建者。

SearchResults

启动此表的搜索作业的参数。

名称 类型 说明
azureAsyncOperationId

string

搜索结果表异步作 ID。

description

string

搜索作业说明。

endSearchTime

string (date-time)

按 UTC 结束搜索的时间戳

limit

integer (int32)

将搜索作业限制为最多返回指定行数。

query

string

搜索作业查询。

sourceTable

string

搜索作业中使用的表。

startSearchTime

string (date-time)

从 (UTC) 开始搜索的时间戳

SourceEnum

表的创建者。

说明
microsoft

系统预配的表,通过诊断设置、代理或任何其他标准数据收集方式收集。

customer

由工作区所有者创建的表,并且仅在此工作区中找到。

systemData

与创建和上次修改资源相关的元数据。

名称 类型 说明
createdAt

string (date-time)

资源创建时间戳(UTC)。

createdBy

string

创建资源的标识。

createdByType

createdByType

创建资源的标识的类型。

lastModifiedAt

string (date-time)

上次修改的资源时间戳(UTC)

lastModifiedBy

string

上次修改资源的标识。

lastModifiedByType

createdByType

上次修改资源的标识的类型。

Table

工作区数据表定义。

名称 类型 说明
id

string

资源的完全限定资源 ID。 示例 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

资源的名称

properties.archiveRetentionInDays

integer (int32)

表的长期保留期(以天为单位)。 计算公式为 (totalRetentionInDays-retentionInDays)。

properties.lastPlanModifiedDate

string

表计划上次修改的时间戳 (UTC)。

properties.plan

TablePlanEnum

指示系统如何处理和收费引入到此表的日志。

properties.provisioningState

ProvisioningStateEnum

表的当前预配状态。 如果设置为“更新”,则表示由于正在进行的作而导致的资源锁定,在正在进行的作结束之前禁止对表进行任何更新。

properties.restoredLogs

RestoredLogs

启动此表的还原作的参数。

properties.resultStatistics

ResultStatistics

搜索作业执行统计信息。

properties.retentionInDays

integer (int32)

minimum: 4
maximum: 730

在分析表中:表中的分析保留期(以天为单位),介于 4 到 730 之间。 将此属性设置为 -1 默认为工作区保留期。 在基本表和辅助表中:只读属性。

properties.retentionInDaysAsDefault

boolean

True - 值源自工作区保留期(以天为单位),False - 特定于客户。

properties.schema

Schema

表架构。

properties.searchResults

SearchResults

启动此表的搜索作业的参数。

properties.totalRetentionInDays

integer (int32)

minimum: 4
maximum: 4383

表总保留期(以天为单位,介于 4 到 4383 之间)。 将此属性设置为 -1 将默认为 retentionInDays。

properties.totalRetentionInDaysAsDefault

boolean

True - 值源自保留期(以天为单位),False - 特定于客户。

systemData

systemData

与创建和上次修改资源相关的元数据。

type

string

资源类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”

TablePlanEnum

指示系统如何处理和收费引入到此表的日志。

说明
Basic

故障排除和事件响应所需的中接触日志。

Analytics

用于持续监控、实时检测和性能分析的高价值日志。

Auxiliary

低接触日志,例如详细日志,以及审核和合规性所需的数据。

TableSubTypeEnum

子类型描述了哪些 API 可用于与表交互,以及可用于表的功能。

说明
Any

用于创建内置表的默认子类型。

Classic

指示通过数据收集器 API 或使用 MMA 代理的自定义日志功能创建的表,或创建自定义字段的任何表。

DataCollectionRuleBased

有资格通过数据收集规则支持的任何方式将数据发送到其中的表:数据收集终结点 API、摄取时间转换或数据收集规则提供的任何其他机制

TableTypeEnum

表的创建者。

说明
Microsoft

Azure Monitor 收集的标准数据。

CustomLog

自定义日志表。

RestoredLogs

恢复的数据。

SearchResults

搜索作业收集的数据。