# Filter logs by request attributes

**URL:** <https://community.dynatrace.com/t/filter-logs-by-request-attributes/40644>\
**Category:** Logs\
**Tags:** log-monitoring-class, dynatrace-saas\
**Created:** [July 12, 2023, 8:56am UTC](https://community.dynatrace.com/t/filter-logs-by-request-attributes/40644 "2023-07-12T08:56:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![amithgeorge](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@amithgeorge](https://community.dynatrace.com/u/amithgeorge)\
**Post date:** [July 12, 2023, 8:56am UTC](https://community.dynatrace.com/t/filter-logs-by-request-attributes/40644/1 "2023-07-12T08:56:19Z")

</div>

We are on SaaS Dynatrace using Logs v2. We add request attributes to our distributed traces.

In Logs Viewer, is there a way to search/filter logs by request attributes? I am aware we can add MDC context to the log lines, however we are trying to avoid that. Considering every log line has a trace\_id and the trace has a request attributes, can we use this to filter logs by request attributes?

---

<div class="post-metadata">

**Author:** ![radek\_jasinski](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/radek_jasinski/32/10432_2.png) [@radek\_jasinski](https://community.dynatrace.com/u/radek_jasinski)\
**Post date:** [July 12, 2023, 9:29am UTC](https://community.dynatrace.com/t/filter-logs-by-request-attributes/40644/2 "2023-07-12T09:29:20Z")

</div>

Hi,

Directly filtering by RA is probably not possible. The best solution would be to switch to Grail.  
You will then gain full analytical capabilities.

> **[Grail](https://docs.dynatrace.com/docs/platform/grail)**
>
> Insights on what and how you can query Dynatrace data.

> **[Log Analytics](https://docs.dynatrace.com/docs/analyze-explore-automate/logs)**
>
> Log Management and Analytics provides a unified approach to controlling and studying your log data in Dynatrace.

Radek

---

<div class="post-metadata">

**Author:** ![amithgeorge](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@amithgeorge](https://community.dynatrace.com/u/amithgeorge)\
**Post date:** [July 12, 2023, 9:38am UTC](https://community.dynatrace.com/t/filter-logs-by-request-attributes/40644/3 "2023-07-12T09:38:43Z")

</div>

I had read the docs for Grail earlier, however I didn’t find anything that suggests I can filter logs using request attributes. Is there something specific you can point me to?

---

<div class="post-metadata">

**Author:** ![radek\_jasinski](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/radek_jasinski/32/10432_2.png) [@radek\_jasinski](https://community.dynatrace.com/u/radek_jasinski)\
**Post date:** [July 12, 2023, 9:40am UTC](https://community.dynatrace.com/t/filter-logs-by-request-attributes/40644/4 "2023-07-12T09:40:18Z")

</div>

You can’t filter logs by request attributes - at least I haven’t encountered such an option.

---

<div class="post-metadata">

**Author:** ![amithgeorge](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@amithgeorge](https://community.dynatrace.com/u/amithgeorge)\
**Post date:** [July 12, 2023, 9:44am UTC](https://community.dynatrace.com/t/filter-logs-by-request-attributes/40644/5 "2023-07-12T09:44:47Z")

</div>

I see the option to do a join using [lookup](https://www.dynatrace.com/support/help/platform/grail/dynatrace-query-language/commands#lookup). What all data objects are available to use with the [fetch](https://www.dynatrace.com/support/help/platform/grail/dynatrace-query-language/commands#fetch) command? Can we fetch distributed traces such that I can do a join between logs and traces?

---

<div class="post-metadata">

**Author:** ![MaciejNeumann](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@MaciejNeumann](https://community.dynatrace.com/u/MaciejNeumann)\
**Post date:** [December 9, 2025, 12:32pm UTC](https://community.dynatrace.com/t/filter-logs-by-request-attributes/40644/6 "2025-12-09T12:32:41Z")

</div>

Hello&nbsp;[@amithgeorge](https://community.dynatrace.com/user/61826),

I just wanted to update this thread with the newest answer. Here is a documentation article:

[Connect log data to traces](https://docs.dynatrace.com/docs/shortlink/lma-log-enrichment)&nbsp;  
About how users can enrich log data in the newest Dynatrace, and add following&nbsp;information to each detected log record:

- `dt.trace_id`
- `dt.span_id`
- `dt.entity.process_group_instance`
