# Parse Json logs with a compact json formatter

**URL:** <https://community.dynatrace.com/t/parse-json-logs-with-a-compact-json-formatter/47597>\
**Category:** DQL\
**Tags:** dql, logs\
**Created:** [September 11, 2024, 12:43pm UTC](https://community.dynatrace.com/t/parse-json-logs-with-a-compact-json-formatter/47597 "2024-09-11T12:43:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![faraz](https://avatars.discourse-cdn.com/v4/letter/f/278dde/32.png) [@faraz](https://community.dynatrace.com/u/faraz)\
**Post date:** [September 11, 2024, 12:43pm UTC](https://community.dynatrace.com/t/parse-json-logs-with-a-compact-json-formatter/47597/1 "2024-09-11T12:43:21Z")

</div>

Hi,&nbsp;  
I am trying to come up with a query to parse the incoming log with compact json format from [Serilog](https://github.com/serilog/serilog-formatting-compact?tab=readme-ov-file#comparison)

The problem I am facing is I cant use&nbsp;@ for the matcher name.

**Sample log**

{“@t”:“2024-09-11T05:25:43.6670035Z”,“@mt”:“Finished publishing product updates.”,“@tr”:“84074a2818729843acdaa18a3650fed5”}

**Query**

fetch logs  
| filter matchesPhrases (content,“12025657”) // to get the exact logs  
| parse content, “JSON:structuredLog”  
| fieldsadd client\_time = structuredLog[@t] // \<--- Syntax Error here with the&nbsp;@t

Any advice would be appreciated

Thanks

---

<div class="post-metadata">

**Author:** ![PedroSantos](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pedrosantos/32/28150_2.png) [@PedroSantos](https://community.dynatrace.com/u/PedroSantos)\
**Post date:** [September 11, 2024, 3:24pm UTC](https://community.dynatrace.com/t/parse-json-logs-with-a-compact-json-formatter/47597/2 "2024-09-11T15:24:26Z")

</div>

Hi [@faraz](https://community.dynatrace.com/user/80428),

You can try using back ticks as detailed here:

[Similar Problem](https://community.dynatrace.com/post/241183)

As a side note, your matchesPhrases function should be matchPhrase 🙂

```python
fetch logs
| filter matchesPhrase(content,"12025657") // to get the exact logs
| parse content, "JSON:structuredLog"
| fieldsadd client_time = structuredLog[`@t`] // <--- Added back ticks here on @t

```

I tested and DQL didn’t complain for me, see if it works for you.

---

<div class="post-metadata">

**Author:** ![faraz](https://avatars.discourse-cdn.com/v4/letter/f/278dde/32.png) [@faraz](https://community.dynatrace.com/u/faraz)\
**Post date:** [September 11, 2024, 11:29pm UTC](https://community.dynatrace.com/t/parse-json-logs-with-a-compact-json-formatter/47597/3 "2024-09-11T23:29:43Z")

</div>

Works like a charm.

Thanks&nbsp;[@PedroSantos](https://community.dynatrace.com/user/77112)
