# Correlate two results logs

**URL:** <https://community.dynatrace.com/t/correlate-two-results-logs/44664>\
**Category:** DQL\
**Tags:** dql, logs\
**Created:** [March 14, 2024, 1:36pm UTC](https://community.dynatrace.com/t/correlate-two-results-logs/44664 "2024-03-14T13:36:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wellpplava](https://avatars.discourse-cdn.com/v4/letter/w/d26b3c/32.png) [@wellpplava](https://community.dynatrace.com/u/wellpplava)\
**Post date:** [March 14, 2024, 1:36pm UTC](https://community.dynatrace.com/t/correlate-two-results-logs/44664/1 "2024-03-14T13:36:14Z")

</div>

Hello!

I have a use case that I need help with.

I need to list the customers who made a purchase, but informing whether there was an error in the journey or not.

I use the following query to find all purchases made:

fetch logs  
| filter ((matchesValue(k8s.container.name, “cart”) and matchesPhrase(content, “submitOrder - end”) and matchesValue(status, “INFO”) and isNotNull(customerid)))

and I use the following query to find all errors during the purchase:

fetch logs  
| filter ((matchesValue(k8s.container.name, “cart”) and matchesValue(status, “ERROR”) and matchesPhrase(content, “submitOrder”) and isNotNull(customerid)))

How can I add the second information to the first using the customerid? Should I use lookup or enjoy?

---

<div class="post-metadata">

**Author:** ![dannemca](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dannemca/32/7215_2.png) [@dannemca](https://community.dynatrace.com/u/dannemca)\
**Post date:** [March 14, 2024, 6:06pm UTC](https://community.dynatrace.com/t/correlate-two-results-logs/44664/2 "2024-03-14T18:06:08Z")

</div>

Try this

```markup
fetch logs
| filter ((matchesValue(k8s.container.name, "cart") and matchesPhrase(content, "submitOrder - end") and matchesValue(status, "INFO") and isNotNull(customerid)))
| lookup [fetch logs
| filter ((matchesValue(k8s.container.name, "cart") and matchesValue(status, "ERROR") and matchesPhrase(content, "submitOrder") and isNotNull(customerid)))
], sourceField:customerid, lookupField:customerid

```

Regards
