<?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 Re: DQL parse of log not getting complete data. in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/DQL-parse-of-log-not-getting-complete-data/m-p/261524#M1400</link>
    <description>&lt;P&gt;Is there any problem with using the JSON parser?&lt;BR /&gt;&lt;A href="https://docs.dynatrace.com/docs/shortlink/dql-use-cases#parse-json-data-and-aggregate-records" target="_blank"&gt;https://docs.dynatrace.com/docs/shortlink/dql-use-cases#parse-json-data-and-aggregate-records&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Nov 2024 13:34:49 GMT</pubDate>
    <dc:creator>PacoPorro</dc:creator>
    <dc:date>2024-11-05T13:34:49Z</dc:date>
    <item>
      <title>DQL parse of log not getting complete data.</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-parse-of-log-not-getting-complete-data/m-p/261520#M1399</link>
      <description>&lt;P&gt;The log below has multiple entries I am only getting the first set with my parse, seems I am missing a way to make it iterate through to the end?&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"content": {&lt;BR /&gt;"alertText": [&lt;BR /&gt;{&lt;BR /&gt;"Id": "Workers-22",&lt;BR /&gt;"SpaceId": "Spaces-1",&lt;BR /&gt;"WorkerPoolIds": [&lt;BR /&gt;"WorkerPools-42"&lt;BR /&gt;],&lt;BR /&gt;"HealthStatus": "HasWarnings",&lt;BR /&gt;"HasLatestCalamari": true,&lt;BR /&gt;"StatusSummary": "This machine is running an old version of Tentacle (xxxxx).",&lt;BR /&gt;"OperatingSystem": "Microsoft Windows Server 2019 Standard xxxxxx"&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"Id": "Workers-23",&lt;BR /&gt;"SpaceId": "Spaces-1",&lt;BR /&gt;"WorkerPoolIds": [&lt;BR /&gt;"WorkerPools-42"&lt;BR /&gt;],&lt;BR /&gt;"HealthStatus": "HasWarnings",&lt;BR /&gt;"HasLatestCalamari": false,&lt;BR /&gt;"StatusSummary": "This machine is running an old version of Tentacle (6.1.1403).",&lt;BR /&gt;"OperatingSystem": "Microsoft Windows Server 2019 Standard xxxxx"&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DQL:&lt;/P&gt;&lt;P&gt;fetch logs&lt;BR /&gt;| filter contains(log.tag, "octopus_workers")&lt;BR /&gt;| fields timestamp, content&lt;BR /&gt;| parse content, "DATA '[{\"Id\":\"' DATA:Id '\",\"SpaceId\":\"' DATA:SpaceId '\",\"WorkerPoolIds\":[\"' DATA:WorkerPoolIds '\"],\"HealthStatus\":\"' DATA:HealthStatus '\",\"HasLatestCalamari\":' DATA:HasLatestCalamri ',\"StatusSummary\":\"' DATA:StatusSummary '\",\"OperatingSystem\":\"' DATA:OperatingSystem '\"},'"&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 12:58:19 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-parse-of-log-not-getting-complete-data/m-p/261520#M1399</guid>
      <dc:creator>rseibert1</dc:creator>
      <dc:date>2024-11-05T12:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: DQL parse of log not getting complete data.</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-parse-of-log-not-getting-complete-data/m-p/261524#M1400</link>
      <description>&lt;P&gt;Is there any problem with using the JSON parser?&lt;BR /&gt;&lt;A href="https://docs.dynatrace.com/docs/shortlink/dql-use-cases#parse-json-data-and-aggregate-records" target="_blank"&gt;https://docs.dynatrace.com/docs/shortlink/dql-use-cases#parse-json-data-and-aggregate-records&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 13:34:49 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-parse-of-log-not-getting-complete-data/m-p/261524#M1400</guid>
      <dc:creator>PacoPorro</dc:creator>
      <dc:date>2024-11-05T13:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: DQL parse of log not getting complete data.</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-parse-of-log-not-getting-complete-data/m-p/261557#M1401</link>
      <description>&lt;P&gt;I am not able to get JSON parser to do what I want either,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rseibert1_0-1730817941305.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/24392iDD7D111062CC6480/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rseibert1_0-1730817941305.png" alt="rseibert1_0-1730817941305.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 14:45:53 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-parse-of-log-not-getting-complete-data/m-p/261557#M1401</guid>
      <dc:creator>rseibert1</dc:creator>
      <dc:date>2024-11-05T14:45:53Z</dc:date>
    </item>
    <item>
      <title>Re: DQL parse of log not getting complete data.</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-parse-of-log-not-getting-complete-data/m-p/261819#M1409</link>
      <description>&lt;P&gt;Seems like I am closer to a solution with the parse content approach but it fails to loop through the whole log, only getting first instance of all the fields:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;fetch logs&lt;BR /&gt;| filter contains(log.tag, "octopus_workers")&lt;BR /&gt;| parse content, """DATA '\"Id\":\"' DATA:Id '\",\"SpaceId\":\"' DATA:SpaceId '\",\"WorkerPoolIds\":[\"' DATA:WorkerPoolIds '\"],\"HealthStatus\":\"' DATA:HealthStatus '\",\"HasLatestCalamari\":' DATA:HasLatestCalamri ',\"StatusSummary\":\"' DATA:StatusSummary '\",\"OperatingSystem\":\"' DATA:OperatingSystem '\"},'"""&lt;BR /&gt;| fields Id, SpaceId, WorkerPoolIds, HealthStatus, StatusSummary, OperatingSystem&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rseibert1_0-1730989272670.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/24457i7E8305BBEF4313EB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rseibert1_0-1730989272670.png" alt="rseibert1_0-1730989272670.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2024 14:21:23 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-parse-of-log-not-getting-complete-data/m-p/261819#M1409</guid>
      <dc:creator>rseibert1</dc:creator>
      <dc:date>2024-11-07T14:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: DQL parse of log not getting complete data.</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-parse-of-log-not-getting-complete-data/m-p/261889#M1412</link>
      <description>&lt;P&gt;For the json parser, Won't be something like json.alertText[0].SpaceId ?&lt;BR /&gt;Please check&amp;nbsp;&lt;A href="https://community.dynatrace.com/t5/DQL/Json-parsing-in-DQL/m-p/242105" target="_blank"&gt;https://community.dynatrace.com/t5/DQL/Json-parsing-in-DQL/m-p/242105&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2024 07:35:46 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-parse-of-log-not-getting-complete-data/m-p/261889#M1412</guid>
      <dc:creator>PacoPorro</dc:creator>
      <dc:date>2024-11-08T07:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: DQL parse of log not getting complete data.</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-parse-of-log-not-getting-complete-data/m-p/261989#M1414</link>
      <description>&lt;P&gt;yes, I found that page, I tried a few different ways to get a single field pulled from the json and not sure what I am missing?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rseibert1_0-1731086371197.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/24479i6E7A4EBFCD060E51/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rseibert1_0-1731086371197.png" alt="rseibert1_0-1731086371197.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2024 17:20:41 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-parse-of-log-not-getting-complete-data/m-p/261989#M1414</guid>
      <dc:creator>rseibert1</dc:creator>
      <dc:date>2024-11-08T17:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: DQL parse of log not getting complete data.</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-parse-of-log-not-getting-complete-data/m-p/261993#M1415</link>
      <description>&lt;P&gt;I tried several solutions along those lines but all of them return null. I must be missing something ?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rseibert1_0-1731089717500.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/24480i1E7C2231D32C9538/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rseibert1_0-1731089717500.png" alt="rseibert1_0-1731089717500.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2024 18:15:30 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-parse-of-log-not-getting-complete-data/m-p/261993#M1415</guid>
      <dc:creator>rseibert1</dc:creator>
      <dc:date>2024-11-08T18:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: DQL parse of log not getting complete data.</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-parse-of-log-not-getting-complete-data/m-p/262155#M1417</link>
      <description>&lt;P&gt;The main issue seems to be that the JSON object is not complete (I presume this is due to copying a partial result of the content. If you right-click on the partial content in the &lt;STRONG&gt;Security Investigator&lt;/STRONG&gt; and view field details, you can see it as a raw string with line-breaks, not as a JSON object:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tiit_Hallas_3-1731406268609.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/24526i54B41D6158DF91BA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tiit_Hallas_3-1731406268609.png" alt="Tiit_Hallas_3-1731406268609.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;If I added the proper ending to the JSON (added "]}}"), the field details looks better:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tiit_Hallas_4-1731406319760.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/24527iEE50F3221295F66C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tiit_Hallas_4-1731406319760.png" alt="Tiit_Hallas_4-1731406319760.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And then the JSON matcher parses it perfectly as well, see the attached screenshot from the Security Investigator record details:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tiit_Hallas_0-1731405088865.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/24522iE2A66824CA1DF82D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tiit_Hallas_0-1731405088865.png" alt="Tiit_Hallas_0-1731405088865.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;To extract single elements from a JSON array to separate fields, you can use the &lt;STRONG&gt;JSON&lt;/STRONG&gt; and &lt;STRONG&gt;JSON_ARRAY&lt;/STRONG&gt; matchers and if you want, you can also extract only specific fields by defining them to the pattern.&lt;/P&gt;
&lt;P&gt;The final pattern that I created looked like this:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;JSON{ 
  JSON{
    JSON_ARRAY{ 
      JSON{ 
        STRING:Id, 
        STRING:SpaceId, 
        STRING:HealthStatus
      } 
    }:alertText
  }(flat=true):content 
}(flat=true)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used the "&lt;STRONG&gt;flat=true&lt;/STRONG&gt;" to unnset the objects + defined the field. After that you can use DQL commands "&lt;STRONG&gt;expand&lt;/STRONG&gt;" and "&lt;STRONG&gt;fieldsFlatten&lt;/STRONG&gt;" to spread the array elements to different records and to flatten the object fields to separate columns.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tiit_Hallas_2-1731406045643.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/24525i577BBBD3510593F0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tiit_Hallas_2-1731406045643.png" alt="Tiit_Hallas_2-1731406045643.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I've shared the Security Investigation case in the Playground with you as well, you can see all the steps that I took by navigating the query tree in the right.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://wkf10640.apps.dynatrace.com/ui/apps/dynatrace.security.investigator/share/b9709361-dd10-4739-820a-145d89c7d4de" target="_blank" rel="noopener"&gt;https://wkf10640.apps.dynatrace.com/ui/apps/dynatrace.security.investigator/share/b9709361-dd10-4739-820a-145d89c7d4de&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 10:12:13 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-parse-of-log-not-getting-complete-data/m-p/262155#M1417</guid>
      <dc:creator>Tiit_Hallas</dc:creator>
      <dc:date>2024-11-12T10:12:13Z</dc:date>
    </item>
  </channel>
</rss>

