访问JSON数组中的值

问题描述 投票:0回答:1

我遵循文档中有关如何在CloudWatch Insights中访问JSON值的说明,其中的推荐如下

JSON arrays are flattened into a list of field names and values. For example, to specify the value of instanceId for the first item in requestParameters.instancesSet, use requestParameters.instancesSet.items.0.instanceId.

ref https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_AnalyzeLogData-discoverable-fields.html

我正在尝试以下内容并得不到任何回报。 intellisense自动填充到processList.0但没有进一步

fields processList.0.vss
| sort @timestamp desc
| limit 1

我正在使用的JSON是

"processList": [
        {
            "vss": xxxxx,
            "name": "aurora",
            "tgid": xxxx,
            "vmlimit": "unlimited",
            "parentID": 1,
            "memoryUsedPc": 16.01,
            "cpuUsedPc": 0.01,
            "id": xxxxx,
            "rss": xxxxx
        },
        {
            "vss": xxxx,
            "name": "aurora",
            "tgid": xxxxxx,
            "vmlimit": "unlimited",
            "parentID": 1,
            "memoryUsedPc": 16.01,
            "cpuUsedPc": 0.06,
            "id": xxxxx,
            "rss": xxxxx
        }]
amazon-cloudwatch amazon-cloudwatchlogs
1个回答
0
投票

你试过以下吗?

fields @@timestamp, @processList.0.vss
| sort @@timestamp desc
| limit 5

这可能是语法错误。如果没有,请发布一些总体结构的记录,包括@timestamp。

© www.soinside.com 2019 - 2024. All rights reserved.