0

我正在尝试将 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 = "*"
)

以上是在一行中摄取整个日志数组,但我希望将其扩展为多行

方法2:

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"}'
']'

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

4

1 回答 1

0

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

作为旁注,使用选项#2,您将丢失“id”属性。

于 2021-06-06T04:58:57.377 回答