# Grail DQL in Log Events Extraction

**URL:** <https://community.dynatrace.com/t/grail-dql-in-log-events-extraction/45893>\
**Category:** DQL\
**Tags:** dql, logs\
**Created:** [June 3, 2024, 3:34pm UTC](https://community.dynatrace.com/t/grail-dql-in-log-events-extraction/45893 "2024-06-03T15:34:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aymeric\_M](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/aymeric_m/32/35713_2.png) [@Aymeric\_M](https://community.dynatrace.com/u/Aymeric_M)\
**Post date:** [June 3, 2024, 3:34pm UTC](https://community.dynatrace.com/t/grail-dql-in-log-events-extraction/45893/1 "2024-06-03T15:34:33Z")

</div>

I’m in a bit of an dead end : since migrating to Grail the “language” used in the log query of Event Extraction is said to be DQL.

One would assume that we could refine the query in Logs & Events advanced mode then copy/paste it in the Log Query field of Event Extraction, like in the good old time of Log Classic.

But it is not as straightforward as before. The form can not be validated without extensive editing of the query.

It seems that the DQL for Event Extraction is a very limited subset of the “real” DQL.

Anyone would have an idea on how to have the following query working in Event Extraction ?

```php
fetch logs
| filter matchesValue(log.source, "frontend")
| filter matchesValue(type, "secu")
| filterOut contains(httpmessage.host, "foo.bar")
| filter toDouble(userriskdata.score) >= 90
| filter matchesValue(attackdata.rules, "USER-RISK-AGGRESSIVE")

```

The documentation is a bit lacking on this subject, so far I guessed that “fetch logs” and the “| filter” keywords should be removed. That leave something like this :

```php
matchesValue(log.source, "frontend")
AND matchesValue(type, "secu")
AND NOT contains(httpmessage.host, "foo.bar")
AND toDouble(userriskdata.score) >= 90
AND matchesValue(attackdata.rules, "USER-RISK-AGGRESSIVE")

```

That is still not valid: “\>”, “contains” and “toDouble” are not recognized.

---

<div class="post-metadata">

**Author:** ![FranciscoGarcia](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/franciscogarcia/32/38292_2.png) [@FranciscoGarcia](https://community.dynatrace.com/u/FranciscoGarcia)\
**Post date:** [June 4, 2024, 3:08pm UTC](https://community.dynatrace.com/t/grail-dql-in-log-events-extraction/45893/2 "2024-06-04T15:08:51Z")

</div>

You can only use a [subset of DQL](https://docs.dynatrace.com/docs/observe-and-explore/logs/lma-log-processing-matcher) (I don’t think you can use toDouble, etc…). Maybe you can use the new [Davis Anomaly detector](https://docs.dynatrace.com/docs/platform/davis-ai/anomaly-detection/anomaly-detection-app) to create a query that queries logs, makes a timeseries and triggers a David event when the vaue exceeds a static or dinamic threshold?

---

<div class="post-metadata">

**Author:** ![Aymeric\_M](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/aymeric_m/32/35713_2.png) [@Aymeric\_M](https://community.dynatrace.com/u/Aymeric_M)\
**Post date:** [June 5, 2024, 3:01pm UTC](https://community.dynatrace.com/t/grail-dql-in-log-events-extraction/45893/3 "2024-06-05T15:01:08Z")

</div>

Thanks for the link to the matcher documentation. I had forgotten about it. I’ll look into Davis Anomaly Detecto. In the mean time I’ll try to work around contains and \> with matchesPhrase.
