# Extract specific value/pattern from log file

**URL:** <https://community.dynatrace.com/t/extract-specific-value-pattern-from-log-file/52025>\
**Category:** DQL\
**Tags:** dql\
**Created:** [June 11, 2025, 11:04am UTC](https://community.dynatrace.com/t/extract-specific-value-pattern-from-log-file/52025 "2025-06-11T11:04:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Agoyals](https://avatars.discourse-cdn.com/v4/letter/a/b77776/32.png) [@Agoyals](https://community.dynatrace.com/u/Agoyals)\
**Post date:** [June 11, 2025, 11:04am UTC](https://community.dynatrace.com/t/extract-specific-value-pattern-from-log-file/52025/1 "2025-06-11T11:04:11Z")

</div>

Hi ,

I am new to Dynatrace and looking to explore logs. Looking for help to extract specific value from logs.

Query  
fetch logs  
| filter dt.host\_group.id == “XXXX” AND log.file.path == “XXXXX”

Example log content

[2025-06-11T05:15:35.487-0400][1596955825ms]&nbsp;GC(175)&nbsp;Pause Young&nbsp;(Normal)&nbsp;(G1 Evacuation Pause)&nbsp;334M-\>40M(512M)&nbsp;5.847ms[2025-06-11T05:15:35.492-0400][1596955830ms]&nbsp;GC(175)&nbsp;Pause Young&nbsp;(Normal)&nbsp;(G1 Evacuation Pause)&nbsp;362M-\>55M(512M)&nbsp;4.827ms[2025-06-11T04:14:04.275-0400][473664263ms]&nbsp;GC(58)&nbsp;Pause Young&nbsp;(Normal)&nbsp;(G1 Evacuation Pause)

Looking to extract the ms value at the end of event. I tried to use parse command but not working.

---

<div class="post-metadata">

**Author:** ![jmarbaix](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@jmarbaix](https://community.dynatrace.com/u/jmarbaix)\
**Post date:** [June 11, 2025, 12:17pm UTC](https://community.dynatrace.com/t/extract-specific-value-pattern-from-log-file/52025/2 "2025-06-11T12:17:59Z")

</div>

Hi Agoyals,

You can do something like this:

fetch logs  
| filter dt.host\_group.id == “XXXX” AND log.file.path == “XXXXX”  
| parse content, “”"  
DATA&nbsp;  
‘(512M)’ // Literal string just before the ms value  
SPACE // Space character before the desired value  
(DIGIT ‘.’ DIGIT):value // The value column will contain the desired number, if it’s always in the form X.XXX  
‘ms’ // To end the parsing

If you want to plot the values, or handle them as a number, you can use the following command:  
| fieldsAdd value = toDouble(value)

Hope this helps.

---

<div class="post-metadata">

**Author:** ![g\_kat](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/g_kat/32/34573_2.png) [@g\_kat](https://community.dynatrace.com/u/g_kat)\
**Post date:** [June 11, 2025, 12:52pm UTC](https://community.dynatrace.com/t/extract-specific-value-pattern-from-log-file/52025/3 "2025-06-11T12:52:53Z")

</div>

Hi,

Adding to&nbsp;[@jmarbaix](https://community.dynatrace.com/user/77377)’s answer, you could also use this parse in case you don’t have that 512M as static:

parse content, “LD’-\>’ LD SPACE (DIGIT’.'DIGIT):value ‘ms’”

Note: if you convert it to double it will round the value to 2 decimal points. In which case, you can straight up transfomr it to double by doing: DOUBLE:value in the parse.

---

<div class="post-metadata">

**Author:** ![jmarbaix](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@jmarbaix](https://community.dynatrace.com/u/jmarbaix)\
**Post date:** [June 11, 2025, 12:55pm UTC](https://community.dynatrace.com/t/extract-specific-value-pattern-from-log-file/52025/4 "2025-06-11T12:55:18Z")

</div>

Good one!
