<?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 How to use the parse command when possible empty value between separators in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/How-to-use-the-parse-command-when-possible-empty-value-between/m-p/259615#M1343</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to extract data from a line of log using a specific format :&lt;/P&gt;&lt;P&gt;provider;id;name;bu;domaine;app;amount;env&lt;/P&gt;&lt;P&gt;My DQL request below works when there is no empty value on my record :&lt;/P&gt;&lt;P&gt;data record(a = "GCP;128773868256;ICDO-KISS;PLFCHAP;PLATE;MYVALUE;DEV;5")&lt;BR /&gt;| parse a, ("LD:provider ';' LD:id ';' LD:name ';' LD:bu ';' LD:domaine ';' LD:app ';' LD:amount ';' LD:env")&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="AurelienGravier_0-1729196726574.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/23748i0D75D9614C22181F/image-size/large?v=v2&amp;amp;px=999" role="button" title="AurelienGravier_0-1729196726574.png" alt="AurelienGravier_0-1729196726574.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it doesn't work if there is an empty value :&lt;/P&gt;&lt;P&gt;data record(a = "GCP;128773868256;ICDO-KISS;PLFCHAP;PLATE&lt;STRONG&gt;;;&lt;/STRONG&gt;DEV;5")&lt;BR /&gt;| parse a, ("LD:provider ';' LD:id ';' LD:name ';' LD:bu ';' LD:domaine ';' LD:app ';' LD:amount ';' LD:env")&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AurelienGravier_2-1729197388820.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/23750i04933FF5083E3D8D/image-size/large?v=v2&amp;amp;px=999" role="button" title="AurelienGravier_2-1729197388820.png" alt="AurelienGravier_2-1729197388820.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to manage empty value on parse command please ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Regards Aurelien&lt;/P&gt;</description>
    <pubDate>Thu, 17 Oct 2024 20:56:07 GMT</pubDate>
    <dc:creator>AurelienGravier</dc:creator>
    <dc:date>2024-10-17T20:56:07Z</dc:date>
    <item>
      <title>How to use the parse command when possible empty value between separators</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-use-the-parse-command-when-possible-empty-value-between/m-p/259615#M1343</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to extract data from a line of log using a specific format :&lt;/P&gt;&lt;P&gt;provider;id;name;bu;domaine;app;amount;env&lt;/P&gt;&lt;P&gt;My DQL request below works when there is no empty value on my record :&lt;/P&gt;&lt;P&gt;data record(a = "GCP;128773868256;ICDO-KISS;PLFCHAP;PLATE;MYVALUE;DEV;5")&lt;BR /&gt;| parse a, ("LD:provider ';' LD:id ';' LD:name ';' LD:bu ';' LD:domaine ';' LD:app ';' LD:amount ';' LD:env")&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="AurelienGravier_0-1729196726574.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/23748i0D75D9614C22181F/image-size/large?v=v2&amp;amp;px=999" role="button" title="AurelienGravier_0-1729196726574.png" alt="AurelienGravier_0-1729196726574.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it doesn't work if there is an empty value :&lt;/P&gt;&lt;P&gt;data record(a = "GCP;128773868256;ICDO-KISS;PLFCHAP;PLATE&lt;STRONG&gt;;;&lt;/STRONG&gt;DEV;5")&lt;BR /&gt;| parse a, ("LD:provider ';' LD:id ';' LD:name ';' LD:bu ';' LD:domaine ';' LD:app ';' LD:amount ';' LD:env")&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AurelienGravier_2-1729197388820.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/23750i04933FF5083E3D8D/image-size/large?v=v2&amp;amp;px=999" role="button" title="AurelienGravier_2-1729197388820.png" alt="AurelienGravier_2-1729197388820.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to manage empty value on parse command please ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Regards Aurelien&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2024 20:56:07 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-use-the-parse-command-when-possible-empty-value-between/m-p/259615#M1343</guid>
      <dc:creator>AurelienGravier</dc:creator>
      <dc:date>2024-10-17T20:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the parse command when possible empty value between separators</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-use-the-parse-command-when-possible-empty-value-between/m-p/259622#M1345</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/44995"&gt;@AurelienGravier&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For your specific example you can use "Optional Modifier" as documented &lt;A href="https://docs.dynatrace.com/docs/platform/grail/dynatrace-pattern-language/log-processing-modifiers#optional-modifier" target="_self"&gt;here&lt;/A&gt;. Using your query, that would look something like the below:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;data record(a = "GCP;128773868256;ICDO-KISS;PLFCHAP;PLATE;;DEV;5")
| parse a, ("WORD:provider ';' WORD:id ';' LD:name ';' WORD:bu ';' WORD:domaine ';' WORD?:app ';' WORD:amount ';' WORD:env")&lt;/LI-CODE&gt;&lt;P&gt;One thing to note though is that I have change the above to use WORD instead of LD. This is because LD matches to semicolons which means if the value in-between is missing it will just match to the second semicolon and the parsing will fail. For the given example you could use WORD for all fields except for name. For name I cam up with a character class that looks like&amp;nbsp;[0-9a-zA-Z-] and the use of which is documented &lt;A href="https://docs.dynatrace.com/docs/shortlink/dpl-lines-strings#character-group" target="_self"&gt;here&lt;/A&gt; but the character class doesn't seem to work. Testing the character class in regex works but within the DQL parse command it doesn't seem to work even though it's supposed to be supported, potentially it requires some more tweaking.&lt;/P&gt;&lt;P&gt;Hope the above helps!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2024 05:10:39 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-use-the-parse-command-when-possible-empty-value-between/m-p/259622#M1345</guid>
      <dc:creator>Fin_Ubels</dc:creator>
      <dc:date>2024-10-18T05:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the parse command when possible empty value between separators</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-use-the-parse-command-when-possible-empty-value-between/m-p/259637#M1347</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/47376"&gt;@Fin_Ubels&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help, I tried &lt;SPAN&gt;"Optional Modifier" without success because I didn't try to change the LD type.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;FYI, with a character group&amp;nbsp;&lt;A href="https://docs.dynatrace.com/docs/shortlink/dpl-lines-strings#character-group" target="_self"&gt;character-group&lt;/A&gt;&amp;nbsp;the name field is parsed with success :&lt;/P&gt;&lt;P&gt;data record(a = "GCP;128773868256;;PLFCHAP;PLATE;;DEV;5")&lt;BR /&gt;| parse a, ("WORD:provider ';' WORD:id ';' &lt;STRONG&gt;[0-9a-zA-Z-]{1,100}?&lt;/STRONG&gt;:name ';' WORD:bu ';' WORD:domaine ';' WORD?:app ';' WORD:amount ';' WORD:env")&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AurelienGravier_0-1729236123232.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/23755i04E240EF8DA57843/image-size/large?v=v2&amp;amp;px=999" role="button" title="AurelienGravier_0-1729236123232.png" alt="AurelienGravier_0-1729236123232.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Regards Aurélien&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;</description>
      <pubDate>Fri, 18 Oct 2024 07:26:22 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-use-the-parse-command-when-possible-empty-value-between/m-p/259637#M1347</guid>
      <dc:creator>AurelienGravier</dc:creator>
      <dc:date>2024-10-18T07:26:22Z</dc:date>
    </item>
  </channel>
</rss>

