【问题标题】:Ingesting from large json files to kusto from blob - expanding array of objects从大型 json 文件摄取到来自 blob 的 kusto - 扩展对象数组
【发布时间】:2021-06-05 00:28:13
【问题描述】:

我正在尝试将 json 文件引入 kusto(.zip 文件),并使用更新策略进一步处理 json

Approach 1 :file has following contents

{
  "id": "id0",
  "logs": [
    {
      "timestamp": "2021-05-26T11:33:26.182Z",
      "message": "test message 1"
    },
    {
      "timestamp": "2021-05-26T11:33:26.182Z",
      "message": "test message 1"
    }
  ]
}

.create table test (
  logs : dynamic
)

.create-or-alter table test ingestion json mapping 'testmapping'
'['
'{"column":"logs","path":"$.logs","datatype":"","transform":"None"}'
']'

.ingest into table test(
  h@"sasUrlfromazureBlob"
)
with (
  format = "multijson",
  ingestionMappingReference = "testmapping",
  zipPattern = "*"
)

上面是在一行中摄取整个日志数组,但我希望它扩展到多行

方法二:

Input file conatains:

[
    {
      "timestamp": "2021-05-26T11:33:26.182Z",
      "message": "test message 1"
    },
    {
      "timestamp": "2021-05-26T11:33:26.182Z",
      "message": "test message 1"
    }
]

.create table test (
  logs : dynamic
)

.create-or-alter table test ingestion json mapping 'testmapping'
'['
'{"column":"logs","path":"$","datatype":"","transform":"None"}'
']'

Above 很好地将日志扩展为多行(本例中为 2 行) 但是当我从一个对象(Approach1)中选择数组时,它会转储到单行中,问题是,它对于动态数据类型有 1MB 数据的限制

【问题讨论】:

    标签: json azure-blob-storage azure-data-explorer data-ingestion ingest


    【解决方案1】:

    如果问题是从选项 #1 中的输入数据到选项 #2 中的所需数据的转换,您应该使用外部服务进行转换,例如,以格式读取数据的 Azure 函数# 1 并将其写为 #2。

    附带说明,使用选项 #2,您将失去“id”属性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多