# How to retrieve nested json in fetch logs

**URL:** <https://community.dynatrace.com/t/how-to-retrieve-nested-json-in-fetch-logs/53849>\
**Category:** Logs\
**Tags:** log-processing, logs\
**Created:** [October 24, 2025, 9:14am UTC](https://community.dynatrace.com/t/how-to-retrieve-nested-json-in-fetch-logs/53849 "2025-10-24T09:14:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkroger](https://avatars.discourse-cdn.com/v4/letter/d/e274bd/32.png) [@dkroger](https://community.dynatrace.com/u/dkroger)\
**Post date:** [October 24, 2025, 9:14am UTC](https://community.dynatrace.com/t/how-to-retrieve-nested-json-in-fetch-logs/53849/1 "2025-10-24T09:14:12Z")

</div>

Hello team,

I having trying to get some fields from keda controller in kubernetes using fetch logs, this query is almost there but missing some nested json values

```markup
fetch logs
| filter matchesValue(k8s.namespace.name, "keda")
| sort timestamp desc
| parse content, "LD JSON:json"
| fieldsFlatten json, fields:{type,namespace,name, error}
| parse error, "LD JSON:error_log"
| fields timestamp, name, namespace, error_log

```

I’m able to get the error log which shows as an actual json:

```markup
{
  "error": {
    "code": "404",
    "message": "Resource not found. The requested item could not be located.",
    "status": "NOT_FOUND",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ResourceInfo",
        "resourceType": "exampleResource",
        "resourceName": "sample-id-123",
        "owner": "sample-owner",
        "description": "The resource with the given ID does not exist."
      }
    ]
  }
}

```

How can I get the message, status and owner in my query above?&nbsp;

 ![Screenshot 2025-10-24 at 3.10.50 a.m..png](https://global.discourse-cdn.com/dynatrace/original/2X/3/3ee6f9ac4115ce0a3d33b3d666e5fbb88390382e.png)

---

<div class="post-metadata">

**Author:** ![darya-ramashko](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/darya-ramashko/32/2370_2.png) [@darya-ramashko](https://community.dynatrace.com/u/darya-ramashko)\
**Post date:** [November 28, 2025, 4:38pm UTC](https://community.dynatrace.com/t/how-to-retrieve-nested-json-in-fetch-logs/53849/2 "2025-11-28T16:38:27Z")

</div>

Hello,

You could try something like this:

```markup
fetch logs
| filter matchesValue(k8s.namespace.name, "keda")
| sort timestamp desc
| parse content, "JSON:json"
| fieldsFlatten json, fields:{type,namespace,name}
| fieldsAdd errorMessage = json[error][message], errorStatus = json[error][status], errorOwner=json[error][details][0][owner]
| fields timestamp, type, name, namespace, errorMessage, errorStatus, errorOwner

```

Hope that helps,

Darya
