# Log Metrics Extraction with a contains clause

**URL:** <https://community.dynatrace.com/t/log-metrics-extraction-with-a-contains-clause/48134>\
**Category:** DQL\
**Tags:** dql, logs\
**Created:** [October 3, 2024, 9:46pm UTC](https://community.dynatrace.com/t/log-metrics-extraction-with-a-contains-clause/48134 "2024-10-03T21:46:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dcole66](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@dcole66](https://community.dynatrace.com/u/dcole66)\
**Post date:** [October 3, 2024, 9:46pm UTC](https://community.dynatrace.com/t/log-metrics-extraction-with-a-contains-clause/48134/1 "2024-10-03T21:46:57Z")

</div>

[DQL matcher in logs - Dynatrace Docs](https://docs.dynatrace.com/docs/observe-and-explore/logs/lma-log-processing-matcher)

Why can I not, according to the documentation, use:

log.source = “mytest” and matchesPhrase(content, “Some text”) to create a log metric from a log file.

I get a LWL Validation error: first invalid character at the (

---

<div class="post-metadata">

**Author:** ![p\_devulapalli](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/p_devulapalli/32/41590_2.png) [@p\_devulapalli](https://community.dynatrace.com/u/p_devulapalli)\
**Post date:** [October 3, 2024, 11:52pm UTC](https://community.dynatrace.com/t/log-metrics-extraction-with-a-contains-clause/48134/2 "2024-10-03T23:52:04Z")

</div>

I think you should use the **==**

can you please try changing

log.source == “mytest” and matchesPhrase(content, “Some text”)

---

<div class="post-metadata">

**Author:** ![dcole66](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@dcole66](https://community.dynatrace.com/u/dcole66)\
**Post date:** [October 4, 2024, 12:03am UTC](https://community.dynatrace.com/t/log-metrics-extraction-with-a-contains-clause/48134/3 "2024-10-04T00:03:39Z")

</div>

It wasn’t happy about that.&nbsp; &nbsp; Complaining about the 2nd = symbol.

I note the document is for DQL.&nbsp; But in the error, this is complaining about LQL.&nbsp; Are these different?

This is from the Creation of a log metric page under log monitoring.&nbsp; On a managed instance (with no grail).&nbsp; The documentation does not have many references for LQL.

---

<div class="post-metadata">

**Author:** ![p\_devulapalli](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/p_devulapalli/32/41590_2.png) [@p\_devulapalli](https://community.dynatrace.com/u/p_devulapalli)\
**Post date:** [October 4, 2024, 1:02am UTC](https://community.dynatrace.com/t/log-metrics-extraction-with-a-contains-clause/48134/4 "2024-10-04T01:02:10Z")

</div>

I tried to do something similar and it does not throw a error in SaaS.

 ![p_devulapalli_0-1728002643994.png](https://global.discourse-cdn.com/dynatrace/original/3X/4/f/4f126d6cd96e5bbb2f2fe97899361fd5b0b855a5.png)

Looking at the managed docs , the procedure seems bit different if you are not on grail. Not sure if that’s causing the issue here in managed

[https://docs.dynatrace.com/managed/observe-and-explore/log-monitoring/analyze-log-data/log-metrics](https://docs.dynatrace.com/managed/observe-and-explore/log-monitoring/analyze-log-data/log-metrics)

---

<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:** [October 4, 2024, 4:38am UTC](https://community.dynatrace.com/t/log-metrics-extraction-with-a-contains-clause/48134/5 "2024-10-04T04:38:59Z")

</div>

As Phani mentioned there are some pretty big differences between managed and SaaS. In managed there is no DQL or Grail and there is different documentation available. [docs.dynatrace.com](http://docs.dynatrace.com) is for SaaS whereas [docs.dyntrace.com/managed/](http://docs.dyntrace.com/managed/) is for managed. For the query syntax you can find that here&nbsp;[https://docs.dynatrace.com/managed/observe-and-explore/log-monitoring/analyze-log-data/log-viewer#sql](https://docs.dynatrace.com/managed/observe-and-explore/log-monitoring/analyze-log-data/log-viewer#sql)

If a UI element in managed took you to the wrong docs it would be good to raise this with support so that it can be rectified.
