# Creating metric with multiple matchers

**URL:** <https://community.dynatrace.com/t/creating-metric-with-multiple-matchers/55376>\
**Category:** Logs\
**Tags:** log-processing, dynatrace-managed, logs\
**Created:** [March 26, 2026, 1:44pm UTC](https://community.dynatrace.com/t/creating-metric-with-multiple-matchers/55376 "2026-03-26T13:44:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joe\_Kulesza](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@Joe\_Kulesza](https://community.dynatrace.com/u/Joe_Kulesza)\
**Post date:** [March 26, 2026, 1:44pm UTC](https://community.dynatrace.com/t/creating-metric-with-multiple-matchers/55376/1 "2026-03-26T13:44:17Z")

</div>

Hi Team,

I am in the process of cleaning up some of our custom alerts and dashboards by converting things into metrics but wanted to see what the best practices are when there are multiple matchers for the query. An example query would be :

fetch logs  
| filter k8s.container.name == “x”  
and k8s.namespace.name == “y” and matchesPhrase(content, “z”) or matchesPhrase(content, “z2”) or matchesPhrase(content, “z3”)  
| summarize count()

would it be best to create a separate metric for each matchesPhrase option or is there a proper way to make this into one metric for a simple log count?

Thanks for any input or suggestions

---

<div class="post-metadata">

**Author:** ![AntonPineiro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antonpineiro/32/49_2.png) [@AntonPineiro](https://community.dynatrace.com/u/AntonPineiro)\
**Post date:** [March 26, 2026, 2:58pm UTC](https://community.dynatrace.com/t/creating-metric-with-multiple-matchers/55376/2 "2026-03-26T14:58:54Z")

</div>

Hi,

Maybe using Openpipeline + metric extraction. You have an example [here](https://docs.dynatrace.com/docs/shortlink/openpipeline-log-processing).

Best regards

---

<div class="post-metadata">

**Author:** ![t\_pawlak](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/t_pawlak/32/14991_2.png) [@t\_pawlak](https://community.dynatrace.com/u/t_pawlak)\
**Post date:** [March 26, 2026, 4:24pm UTC](https://community.dynatrace.com/t/creating-metric-with-multiple-matchers/55376/3 "2026-03-26T16:24:04Z")

</div>

Hi,  
that makes sense.

But I think the answer depends on the goal:

- if the requirement is just to count matching logs in DQL, then a single query/metric with grouped OR conditions is enough, for example:

```markup
fetch logs
| filter k8s.cluster.name == "gke-live"
  and k8s.namespace.name == "online-boutique"
  and (
    matchesPhrase(content, "4cefce565e791b2f")
    or matchesPhrase(content, "acf295bf59a432028d879e50cf4b6674")
  )
| summarize count()

```

 ![logs.jpg](https://global.discourse-cdn.com/dynatrace/original/3X/d/0/d005ccf287beacf2e9dfdf69d741adcd2631ccee.jpeg)

- if the goal is long-term monitoring, dashboarding, or alerting, then OpenPipeline + metric extraction is probably the better approach, because Dynatrace supports extracting metrics from logs during ingest and routing data through dedicated log pipelines.&nbsp;[Log processing with OpenPipeline](https://docs.dynatrace.com/docs/analyze-explore-automate/logs/lma-log-processing/lma-openpipeline)
