# How to match a timestamp field in a Log

**URL:** <https://community.dynatrace.com/t/how-to-match-a-timestamp-field-in-a-log/43086>\
**Category:** DQL\
**Tags:** dql, logs\
**Created:** [December 7, 2023, 5:21pm UTC](https://community.dynatrace.com/t/how-to-match-a-timestamp-field-in-a-log/43086 "2023-12-07T17:21:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dynaNoob](https://avatars.discourse-cdn.com/v4/letter/d/a698b9/32.png) [@dynaNoob](https://community.dynatrace.com/u/dynaNoob)\
**Post date:** [December 7, 2023, 5:21pm UTC](https://community.dynatrace.com/t/how-to-match-a-timestamp-field-in-a-log/43086/1 "2023-12-07T17:21:00Z")

</div>

I am very new to DQL and I am trying to breakdown a time field in a log content

Ex:

content:

WARN, Module 1 has a thread in hung state, Thread hang duration: 00:00:00:32 -

WARN, Module 2 has a thread in hung state, Thread hang duration: 00:00:54:15 -

WARN, Module 3 has a thread in hung state, Thread hang duration: 00:00:1:36 -

I am trying to extract “Thread hang duration” into a time field and if it is over a certain threshold value alert it.

Query used:

fetch logs  
| filter contains(content, “hang duration”)  
| parse content, “LD ‘Thread hang duration:’ LD:HangDuration SPACE ‘-’”  
| fields content, HangDuration

As you can see I have parsed it with LD which works but if I use any other data type, I get null. I have tried

timestamp, duration while parsing as well as converting it from parsed string like below

| fieldsAdd myHangDuration = toTimestamp(HangDuration)

---

<div class="post-metadata">

**Author:** ![gbaudart](https://avatars.discourse-cdn.com/v4/letter/g/e47c2d/32.png) [@gbaudart](https://community.dynatrace.com/u/gbaudart)\
**Post date:** [January 5, 2024, 9:17pm UTC](https://community.dynatrace.com/t/how-to-match-a-timestamp-field-in-a-log/43086/2 "2024-01-05T21:17:13Z")

</div>

Hi&nbsp;[@dynaNoob](https://community.dynatrace.com/user/69662)

do you have try this :

```markup
| fieldsAdd myHangDuration = duration(HangDuration, unit:"s")

```
