# Iterate through an log record

**URL:** <https://community.dynatrace.com/t/iterate-through-an-log-record/48699>\
**Category:** DQL\
**Tags:** dql, logs\
**Created:** [November 4, 2024, 5:40pm UTC](https://community.dynatrace.com/t/iterate-through-an-log-record/48699 "2024-11-04T17:40:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![olgatimbur](https://avatars.discourse-cdn.com/v4/letter/o/fbc32d/32.png) [@olgatimbur](https://community.dynatrace.com/u/olgatimbur)\
**Post date:** [November 4, 2024, 5:40pm UTC](https://community.dynatrace.com/t/iterate-through-an-log-record/48699/1 "2024-11-04T17:40:20Z")

</div>

I am trying to determine a status of a scenario as passed/failed  
| fieldsAdd status = event[steps]  
Each step record can have a list of element and results:  
example:  
[{ “result”: “passed”, “error”: “” },{ “name”: “I login to profile”, “result”: “passed”, “error”: “” },]&nbsp;  
i need to iterate through it, if any of the result is failed, the scenario will get a failed status&nbsp;  
else passed

Thank you

---

<div class="post-metadata">

**Author:** ![Fin\_Ubels](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/fin_ubels/32/18008_2.png) [@Fin\_Ubels](https://community.dynatrace.com/u/Fin_Ubels)\
**Post date:** [November 5, 2024, 1:57am UTC](https://community.dynatrace.com/t/iterate-through-an-log-record/48699/2 "2024-11-05T01:57:31Z")

</div>

Hey&nbsp;[@olgatimbur](https://community.dynatrace.com/user/82722)

If all you need is whether or not there is a fail could you use the contains function as below?

```markup
fetch logs
| fieldsAdd status = if(contains(content, "\"result\": \"failed\""), "failed", else:"passed")

```

---

<div class="post-metadata">

**Author:** ![olgatimbur](https://avatars.discourse-cdn.com/v4/letter/o/fbc32d/32.png) [@olgatimbur](https://community.dynatrace.com/u/olgatimbur)\
**Post date:** [November 5, 2024, 4:20am UTC](https://community.dynatrace.com/t/iterate-through-an-log-record/48699/3 "2024-11-05T04:20:10Z")

</div>

Thank you
