<?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 multiple entries in quotes in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Parse-multiple-entries-in-quotes/m-p/235550#M589</link>
    <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Just a follow up on this one...&amp;nbsp; but slightly different question,&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/38283"&gt;@sinisa_zubic&lt;/a&gt;&amp;nbsp;as you are clearly a wizard in this area......&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;A href="https://community.dynatrace.com/t5/DQL/simple-csv-event-log-parse/m-p/234060/thread-id/545" target="_blank"&gt;Solved: simple csv event log parse - Dynatrace Community&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;So IF i have some lines in my log with multiple entries, but not all...&amp;nbsp; for example&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;2024-01-11T13:23:02.578Z,192.168.0.100,Server1,Tree,Green,Warning&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;2024-01-11T13:24:06.345Z,192.168.0.103,Server2,Bush,DarkGreen,Alert&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;2024-01-11T13:27:04.543Z,192.168.0.103,Server2,Road,"Grey,Yellow,White",Alert&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;2024-01-11T13:28:03.345Z,192.168.0.178,Server5,Path,Black,Bannana&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;how would I&amp;nbsp;get the this to parse, as the 3rd line has multiple entries in the 5th field, comma separated, but encapsulated in "".&amp;nbsp; the way you showed me wont work as the Colour field is also csv, but in quotes?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;JSONTIMESTAMP*:timestamp_parsed ','&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;IPV4ADDR*:clientip ','&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;LD*:clienthostname ','&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;LD*:object ','&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;(Array{LD*:i ('"' | &amp;gt;&amp;gt;',')}{1,}:Colour)? '",'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;LD*:status&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;any guidance&amp;nbsp;would be appreciated&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jan 2024 15:48:53 GMT</pubDate>
    <dc:creator>S_Hadley1138</dc:creator>
    <dc:date>2024-01-25T15:48:53Z</dc:date>
    <item>
      <title>Parse multiple entries in quotes</title>
      <link>https://community.dynatrace.com/t5/DQL/Parse-multiple-entries-in-quotes/m-p/235550#M589</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Just a follow up on this one...&amp;nbsp; but slightly different question,&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/38283"&gt;@sinisa_zubic&lt;/a&gt;&amp;nbsp;as you are clearly a wizard in this area......&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;A href="https://community.dynatrace.com/t5/DQL/simple-csv-event-log-parse/m-p/234060/thread-id/545" target="_blank"&gt;Solved: simple csv event log parse - Dynatrace Community&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;So IF i have some lines in my log with multiple entries, but not all...&amp;nbsp; for example&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;2024-01-11T13:23:02.578Z,192.168.0.100,Server1,Tree,Green,Warning&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;2024-01-11T13:24:06.345Z,192.168.0.103,Server2,Bush,DarkGreen,Alert&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;2024-01-11T13:27:04.543Z,192.168.0.103,Server2,Road,"Grey,Yellow,White",Alert&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;2024-01-11T13:28:03.345Z,192.168.0.178,Server5,Path,Black,Bannana&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;how would I&amp;nbsp;get the this to parse, as the 3rd line has multiple entries in the 5th field, comma separated, but encapsulated in "".&amp;nbsp; the way you showed me wont work as the Colour field is also csv, but in quotes?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;JSONTIMESTAMP*:timestamp_parsed ','&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;IPV4ADDR*:clientip ','&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;LD*:clienthostname ','&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;LD*:object ','&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;(Array{LD*:i ('"' | &amp;gt;&amp;gt;',')}{1,}:Colour)? '",'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;LD*:status&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;any guidance&amp;nbsp;would be appreciated&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2024 15:48:53 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Parse-multiple-entries-in-quotes/m-p/235550#M589</guid>
      <dc:creator>S_Hadley1138</dc:creator>
      <dc:date>2024-01-25T15:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Parse multiple entries in quotes</title>
      <link>https://community.dynatrace.com/t5/DQL/Parse-multiple-entries-in-quotes/m-p/235567#M590</link>
      <description>&lt;P&gt;I would do it in 2 steps:&lt;BR /&gt;- as 5th field can be just string or quoted string, alterative comes in handy like in previous exercise. There are ready to use DPL matchers for quoted strings:&amp;nbsp;&lt;A href="https://docs.dynatrace.com/docs/platform/grail/dynatrace-pattern-language/log-processing-lines-strings#quoted-strings" target="_blank"&gt;https://docs.dynatrace.com/docs/platform/grail/dynatrace-pattern-language/log-processing-lines-strings#quoted-strings&lt;/A&gt;&amp;nbsp;like &lt;STRONG&gt;&lt;EM&gt;DQS&lt;/EM&gt;&lt;/STRONG&gt; I used. Please not that order matters.&lt;BR /&gt;- when we have color or multiple colors captured in color field, it can be split into array using &lt;STRONG&gt;&lt;EM&gt;splitString&lt;/EM&gt;&lt;/STRONG&gt; function&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;data record(c="2024-01-11T13:23:02.578Z,192.168.0.100,Server1,Tree,Green,Warning"),
record(c="2024-01-11T13:24:06.345Z,192.168.0.103,Server2,Bush,DarkGreen,Alert"),
record(c="2024-01-11T13:27:04.543Z,192.168.0.103,Server2,Road,\"Grey,Yellow,White\",Alert"),
record(c="2024-01-11T13:28:03.345Z,192.168.0.178,Server5,Path,Black,Bannana"),
record(c="2024-01-11T13:28:03.345Z,192.168.0.178,Server5,Path,,Nothing")
| parse c, "JSONTIMESTAMP*:timestamp_parsed ',' IPV4ADDR*:clientip ',' LD*:clienthostname ',' LD*:object ',' (DQS*:color|LD*:color) ',' LD*:status"
| fieldsAdd color=splitString(color,",")&lt;/LI-CODE&gt;&lt;P&gt;Result looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_0-1706210841982.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/17223iAF166EE2E6BDF23C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="krzysztof_hoja_0-1706210841982.png" alt="krzysztof_hoja_0-1706210841982.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2024 19:29:51 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Parse-multiple-entries-in-quotes/m-p/235567#M590</guid>
      <dc:creator>krzysztof_hoja</dc:creator>
      <dc:date>2024-01-25T19:29:51Z</dc:date>
    </item>
  </channel>
</rss>

