<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Parse Json logs with a compact json formatter in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Parse-Json-logs-with-a-compact-json-formatter/m-p/255457#M1208</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;I am trying to come up with a query to parse the incoming log with compact json format from &lt;A href="https://github.com/serilog/serilog-formatting-compact?tab=readme-ov-file#comparison" target="_self"&gt;Serilog&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The problem I am facing is I cant use&amp;nbsp;@ for the matcher name.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sample log&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;{"@t":"2024-09-11T05:25:43.6670035Z","@mt":"Finished publishing product updates.","@tr":"84074a2818729843acdaa18a3650fed5"}&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Query&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;fetch logs&lt;BR /&gt;| filter matchesPhrases (content,"12025657") // to get the exact logs&lt;BR /&gt;| parse content, "JSON:structuredLog"&lt;BR /&gt;| fieldsadd client_time = structuredLog[@t] // &amp;lt;--- Syntax Error here with the&amp;nbsp;@t&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice would be appreciated&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Sep 2024 12:43:21 GMT</pubDate>
    <dc:creator>faraz</dc:creator>
    <dc:date>2024-09-11T12:43:21Z</dc:date>
    <item>
      <title>Parse Json logs with a compact json formatter</title>
      <link>https://community.dynatrace.com/t5/DQL/Parse-Json-logs-with-a-compact-json-formatter/m-p/255457#M1208</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;I am trying to come up with a query to parse the incoming log with compact json format from &lt;A href="https://github.com/serilog/serilog-formatting-compact?tab=readme-ov-file#comparison" target="_self"&gt;Serilog&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The problem I am facing is I cant use&amp;nbsp;@ for the matcher name.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sample log&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;{"@t":"2024-09-11T05:25:43.6670035Z","@mt":"Finished publishing product updates.","@tr":"84074a2818729843acdaa18a3650fed5"}&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Query&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;fetch logs&lt;BR /&gt;| filter matchesPhrases (content,"12025657") // to get the exact logs&lt;BR /&gt;| parse content, "JSON:structuredLog"&lt;BR /&gt;| fieldsadd client_time = structuredLog[@t] // &amp;lt;--- Syntax Error here with the&amp;nbsp;@t&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice would be appreciated&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 12:43:21 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Parse-Json-logs-with-a-compact-json-formatter/m-p/255457#M1208</guid>
      <dc:creator>faraz</dc:creator>
      <dc:date>2024-09-11T12:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: Parse Json logs with a compact json formatter</title>
      <link>https://community.dynatrace.com/t5/DQL/Parse-Json-logs-with-a-compact-json-formatter/m-p/255493#M1209</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/80428"&gt;@faraz&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;You can try using back ticks as detailed here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.dynatrace.com/t5/DQL/Parsing-a-JSON-with-special-characters/m-p/241183" target="_self"&gt;Similar Problem&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a side note, your matchesPhrases function should be matchPhrase &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;fetch logs
| filter matchesPhrase(content,"12025657") // to get the exact logs
| parse content, "JSON:structuredLog"
| fieldsadd client_time = structuredLog[`@t`] // &amp;lt;--- Added back ticks here on @t &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tested and DQL didn't complain for me, see if it works for you.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 15:26:03 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Parse-Json-logs-with-a-compact-json-formatter/m-p/255493#M1209</guid>
      <dc:creator>PedroSantos</dc:creator>
      <dc:date>2024-09-11T15:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: Parse Json logs with a compact json formatter</title>
      <link>https://community.dynatrace.com/t5/DQL/Parse-Json-logs-with-a-compact-json-formatter/m-p/255538#M1210</link>
      <description>&lt;P&gt;Works like a charm.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/77112"&gt;@PedroSantos&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 23:29:43 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Parse-Json-logs-with-a-compact-json-formatter/m-p/255538#M1210</guid>
      <dc:creator>faraz</dc:creator>
      <dc:date>2024-09-11T23:29:43Z</dc:date>
    </item>
  </channel>
</rss>

