# Use DQL Equivalent of Putty Grep Command for Data Filtering

**URL:** <https://community.dynatrace.com/t/use-dql-equivalent-of-putty-grep-command-for-data-filtering/54135>\
**Category:** DQL\
**Tags:** dql\
**Created:** [November 19, 2025, 2:12pm UTC](https://community.dynatrace.com/t/use-dql-equivalent-of-putty-grep-command-for-data-filtering/54135 "2025-11-19T14:12:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![apanoobee](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@apanoobee](https://community.dynatrace.com/u/apanoobee)\
**Post date:** [November 19, 2025, 2:12pm UTC](https://community.dynatrace.com/t/use-dql-equivalent-of-putty-grep-command-for-data-filtering/54135/1 "2025-11-19T14:12:47Z")

</div>

I am trying to translate this string to DQL and failing miserably. Can anyone help?

_grep -i “exception” /data/this/will/be/the/folder/location/\*.log | sort | uniq -c | sort -nr | head -n 10_

Basically, anything that has the word “exception” in the log from the a folder location I would like to be able to view them in data explorer / dashboard / notebook.

Can anyone help me how to properly translate this to DQL?

---

<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:** [November 19, 2025, 2:44pm UTC](https://community.dynatrace.com/t/use-dql-equivalent-of-putty-grep-command-for-data-filtering/54135/2 "2025-11-19T14:44:26Z")

</div>

Hi,  
try with this:

```markup
fetch logs
| filter contains(content, "exception", caseSensitive:false)
| filter contains(log.source, "/data/this/will/be/the/folder/location/")
| summarize { cnt = count() }, by:{content}
| sort cnt desc
| limit 10

```

grep -i “exception” filter contains(content, “exception”, caseSensitive:false)  
\*.log in a folder filter contains(log.source, “/data/…/”)  
uniq -c summarize { cnt = count() }, by:{content}  
sort -nr sort cnt desc  
head -n 10 limit 10

---

<div class="post-metadata">

**Author:** ![apanoobee](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@apanoobee](https://community.dynatrace.com/u/apanoobee)\
**Post date:** [November 19, 2025, 3:01pm UTC](https://community.dynatrace.com/t/use-dql-equivalent-of-putty-grep-command-for-data-filtering/54135/3 "2025-11-19T15:01:27Z")

</div>

Thank you. I think I might have solved it by using:

_fetch logs_  
_| filter matchesValue(host.name, “#####.domain.net”) AND matchesValue(log.source, “data/this/will/be/the/folder/location/\*”) AND matchesValue(content, “\*exception\*”)_  
_| sort timestamp desc_  
_| limit 10_
