<?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 record the result from a DQL query and modify the output in Automations</title>
    <link>https://community.dynatrace.com/t5/Automations/How-to-record-the-result-from-a-DQL-query-and-modify-the-output/m-p/276590#M2139</link>
    <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;
&lt;P&gt;I am trying to record content from the result/output of the previous DQL query so that I can modify the output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;DQL query:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;timeseries { count(`metric-A`), value.A = avg(`metric-A`, scalar: true) }, by: { message_vpn_name, client_user_name }, filter: { NOT matchesValue(client_user_name, "X=xyz.abc") AND NOT matchesValue(client_user_name, "*12345*") }&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Sample Output in table format:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;VPN&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;client_user_name&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;EFGHI&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;def-sit.com&lt;/P&gt;
&lt;P&gt;JIKOL&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;def-int.com&lt;/P&gt;
&lt;P&gt;etc.....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I want to record this output and then remove everything from '-' in the output (ex:&amp;nbsp;-sit.com,&amp;nbsp;-int.com, etc).&lt;/P&gt;
&lt;P&gt;I tried using "data record(content" metric command and then string function "&lt;SPAN&gt;replaceString&lt;/SPAN&gt;" to modify the output which is not working.&lt;/P&gt;
&lt;P&gt;Please suggest the right the metric command and string function or for loop if possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 May 2025 07:04:55 GMT</pubDate>
    <dc:creator>Kaladhar</dc:creator>
    <dc:date>2025-05-07T07:04:55Z</dc:date>
    <item>
      <title>How to record the result from a DQL query and modify the output</title>
      <link>https://community.dynatrace.com/t5/Automations/How-to-record-the-result-from-a-DQL-query-and-modify-the-output/m-p/276590#M2139</link>
      <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;
&lt;P&gt;I am trying to record content from the result/output of the previous DQL query so that I can modify the output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;DQL query:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;timeseries { count(`metric-A`), value.A = avg(`metric-A`, scalar: true) }, by: { message_vpn_name, client_user_name }, filter: { NOT matchesValue(client_user_name, "X=xyz.abc") AND NOT matchesValue(client_user_name, "*12345*") }&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Sample Output in table format:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;VPN&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;client_user_name&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;EFGHI&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;def-sit.com&lt;/P&gt;
&lt;P&gt;JIKOL&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;def-int.com&lt;/P&gt;
&lt;P&gt;etc.....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I want to record this output and then remove everything from '-' in the output (ex:&amp;nbsp;-sit.com,&amp;nbsp;-int.com, etc).&lt;/P&gt;
&lt;P&gt;I tried using "data record(content" metric command and then string function "&lt;SPAN&gt;replaceString&lt;/SPAN&gt;" to modify the output which is not working.&lt;/P&gt;
&lt;P&gt;Please suggest the right the metric command and string function or for loop if possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 May 2025 07:04:55 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/How-to-record-the-result-from-a-DQL-query-and-modify-the-output/m-p/276590#M2139</guid>
      <dc:creator>Kaladhar</dc:creator>
      <dc:date>2025-05-07T07:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to record the result from a DQL query and modify the output</title>
      <link>https://community.dynatrace.com/t5/Automations/How-to-record-the-result-from-a-DQL-query-and-modify-the-output/m-p/276618#M2140</link>
      <description>&lt;P&gt;ReplaceString requires an exact string. You can either try to make a pattern and use replacePattern or split the string based on the "-".&lt;BR /&gt;One example I came up with (using cpu metric as an example)&lt;BR /&gt;client_user_name_adjusted field will have the value of any "k8s.node.name" which comes before the first "-":&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;timeseries { avg(dt.host.cpu.user), value.A = avg(dt.host.cpu.user, scalar: true) }, by: { k8s.node.name, host.name }
| fieldsAdd client_user_name_adjusted = splitString(k8s.node.name, "-")[0]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 May 2025 08:09:55 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/How-to-record-the-result-from-a-DQL-query-and-modify-the-output/m-p/276618#M2140</guid>
      <dc:creator>ChristopherHejl</dc:creator>
      <dc:date>2025-05-07T08:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to record the result from a DQL query and modify the output</title>
      <link>https://community.dynatrace.com/t5/Automations/How-to-record-the-result-from-a-DQL-query-and-modify-the-output/m-p/276646#M2141</link>
      <description>&lt;P&gt;This looks great. Thanks for the quick response.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just want to update that another string function substring(xyz_abc_123, from: 0, to: 3) does the work for me.&lt;/P&gt;</description>
      <pubDate>Wed, 07 May 2025 11:27:42 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/How-to-record-the-result-from-a-DQL-query-and-modify-the-output/m-p/276646#M2141</guid>
      <dc:creator>Kaladhar</dc:creator>
      <dc:date>2025-05-07T11:27:42Z</dc:date>
    </item>
  </channel>
</rss>

