<?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: How to derive a field in DQL in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236396#M626</link>
    <description>&lt;P&gt;We are not able to create metrics directly from raw DQL (&lt;A href="https://community.dynatrace.com/t5/Product-ideas/RFE-Create-Custom-Metrics-from-Raw-DQL/idi-p/233074" target="_self"&gt;there is an idea for that&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;In this case, you want to be notified if a job is still running, means jobstatus is not "ENDED OK" nor "ENDED NOTOK", right? So you can just set these conditions in the matcher, like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;matchesValue(log.source, "/opt/controlm/ctmagent/ctm/dailylog/daily_ctmag_*") and  (matchesphrase(jobstatus, "ENDED OK") OR matchesphrase(jobstatus, "ENDED NOTOK"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you can set some dimensions like timestamp, job, orderid ,runno and jobstatus.&lt;/P&gt;&lt;P&gt;You can use these dimensions to work on the metric selector and define the alerts rules by it.&lt;/P&gt;&lt;P&gt;Try and let us know.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Feb 2024 20:56:15 GMT</pubDate>
    <dc:creator>dannemca</dc:creator>
    <dc:date>2024-02-06T20:56:15Z</dc:date>
    <item>
      <title>How to derive a field in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236303#M615</link>
      <description>&lt;P&gt;I have a problem where i need to check log content for job status. If the job status is STARTED and not ENDED yet then need to show as Running, and if the Job status is started and ended ok, then Completed, else if job status is Started and ended not ok then failed. Any help is appreciated. Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 10:57:28 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236303#M615</guid>
      <dc:creator>susmita_k</dc:creator>
      <dc:date>2024-02-07T10:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive a field in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236306#M616</link>
      <description>&lt;P&gt;You should be able to achieve this with the Conditional IF:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.dynatrace.com/docs/platform/grail/dynatrace-query-language/functions/conditional-functions#if" target="_blank"&gt;https://docs.dynatrace.com/docs/platform/grail/dynatrace-query-language/functions/conditional-functions#if&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 17:31:25 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236306#M616</guid>
      <dc:creator>dannemca</dc:creator>
      <dc:date>2024-02-05T17:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive a field in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236384#M620</link>
      <description>&lt;P&gt;I have tried below, it is only working for the first condition, but when its NOT OK, its not returning as Failed. Is it not how it should be done ?&lt;/P&gt;&lt;P&gt;fetch logs //, scanLimitGBytes: 500, samplingRatio: 1000&lt;BR /&gt;| filter matchesValue(log.source, "/opt/controlm/ctmagent/ctm/dailylog/daily_ctmag_*")&lt;BR /&gt;and matchesphrase(jobstatus, "STARTED")&lt;BR /&gt;|filter in(job,array($jobname))&lt;BR /&gt;|parse content , "TIMESTAMP('MMdd hhmmss'):Starttime"&lt;BR /&gt;|fields job, orderid, runno,Starttime,host.name&lt;BR /&gt;| join [fetch logs&lt;BR /&gt;| filter matchesValue(log.source, "/opt/controlm/ctmagent/ctm/dailylog/daily_ctmag_*")&lt;BR /&gt;| filter matchesphrase(jobstatus, "ENDED OK") OR matchesphrase(jobstatus, "ENDED NOTOK")&lt;BR /&gt;|filter in(job,array($jobname))&lt;BR /&gt;|parse content , "TIMESTAMP('MMdd hhmmss'):EndTime"&lt;BR /&gt;|parse content , "LD 'elapsed -', LD:RunTime 'cpu'"&lt;BR /&gt;&lt;BR /&gt;|fieldsadd Current_status =if(matchesphrase(jobstatus, "ENDED OK"), "Completed"),if(matchesphrase(jobstatus, "ENDED NOTOK"),"Failed",else: "Running")&lt;BR /&gt;|fields orderid,runno,jobstatus,Current_status,EndTime,RunTime&lt;/P&gt;&lt;P&gt;] , on: {orderid,runno}&lt;BR /&gt;|fields host.name, job, orderid, runno,right.jobstatus, right.Current_status, Starttime,right.EndTime, right.RunTime&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 17:25:24 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236384#M620</guid>
      <dc:creator>susmita_k</dc:creator>
      <dc:date>2024-02-06T17:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive a field in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236386#M621</link>
      <description>&lt;P&gt;Try this If condition:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;data record(jobstatus="ENDED OK"), record(jobstatus="ENDED NOTOK"), record(jobstatus="Danne")
| fieldsadd Current_status =if((not matchesphrase(jobstatus, "ENDED OK")) and (not matchesphrase(jobstatus, "ENDED NOTOK")), "Running", else: (if(matchesphrase(jobstatus, "ENDED OK"), "Completed", else: "Failed")))&lt;/LI-CODE&gt;&lt;P&gt;Results:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 981px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/17428iD1ECA475B72DD839/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 18:01:36 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236386#M621</guid>
      <dc:creator>dannemca</dc:creator>
      <dc:date>2024-02-06T18:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive a field in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236387#M622</link>
      <description>&lt;P&gt;Thank you! it works as expected.&lt;/P&gt;&lt;P&gt;I'm trying to add an alert for the jobs with 'Running' status, to see if the job is running more than certain (for e.g 30 mins) time, then send an alert saying this job is long running. I'm not sure how can I achieve this. Any pointer would be very helpful.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 18:52:55 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236387#M622</guid>
      <dc:creator>susmita_k</dc:creator>
      <dc:date>2024-02-06T18:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive a field in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236388#M623</link>
      <description>&lt;P&gt;First you will need to create a metric, following this procedure:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.dynatrace.com/docs/observe-and-explore/logs/lma-analysis/lma-log-metrics#create-metric-using-settings" target="_blank"&gt;https://docs.dynatrace.com/docs/observe-and-explore/logs/lma-analysis/lma-log-metrics#create-metric-using-settings&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Then, once the metric starts to receive data points, you can create a metric event for alerting:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.dynatrace.com/docs/platform/davis-ai/anomaly-detection/metric-events" target="_blank"&gt;https://docs.dynatrace.com/docs/platform/davis-ai/anomaly-detection/metric-events&lt;/A&gt;&lt;/P&gt;&lt;P&gt;making sure to adjust the interval to 30 mins.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 18:58:01 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236388#M623</guid>
      <dc:creator>dannemca</dc:creator>
      <dc:date>2024-02-06T18:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive a field in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236395#M625</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/18264"&gt;@dannemca&lt;/a&gt;&amp;nbsp;Thanks for the pointer, however, I need to do join to get the job run time for running jobs, and below is my query&amp;nbsp; -&lt;/P&gt;&lt;P&gt;| filter matchesValue(log.source, "/opt/controlm/ctmagent/ctm/dailylog/daily_ctmag_*") and matchesphrase(jobstatus, "STARTED")&lt;BR /&gt;|parse content , "TIMESTAMP('MMdd hhmmss'):startts"&lt;BR /&gt;|fields startts,job, orderid, runno&lt;BR /&gt;| join [fetch logs&lt;BR /&gt;| filter matchesValue(log.source, "/opt/controlm/ctmagent/ctm/dailylog/daily_ctmag_*")&lt;BR /&gt;| filter matchesphrase(jobstatus, "ENDED OK") OR matchesphrase(jobstatus, "ENDED NOTOK")&lt;BR /&gt;|fieldsadd Current_status =if((not matchesphrase(jobstatus, "ENDED OK")) and (not matchesphrase(jobstatus, "ENDED NOTOK")), "Running")&lt;BR /&gt;|fieldsadd duration= if (jobstatus == "Running", (unixSecondsFromTimestamp(now()) - unixSecondsFromTimestamp(startts)))&lt;BR /&gt;| fields orderid,runno,jobstatus,duration&lt;/P&gt;&lt;P&gt;] , on:{orderid, runno}&lt;BR /&gt;| fields orderid,runno,job,right.jobstatus,right.duration&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I am not able to do the join condition in processor, so not able to get this duration for the log metrics. Is there another place where I can run this on a scheduled time to identify long running job and alert ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 20:40:48 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236395#M625</guid>
      <dc:creator>susmita_k</dc:creator>
      <dc:date>2024-02-06T20:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive a field in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236396#M626</link>
      <description>&lt;P&gt;We are not able to create metrics directly from raw DQL (&lt;A href="https://community.dynatrace.com/t5/Product-ideas/RFE-Create-Custom-Metrics-from-Raw-DQL/idi-p/233074" target="_self"&gt;there is an idea for that&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;In this case, you want to be notified if a job is still running, means jobstatus is not "ENDED OK" nor "ENDED NOTOK", right? So you can just set these conditions in the matcher, like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;matchesValue(log.source, "/opt/controlm/ctmagent/ctm/dailylog/daily_ctmag_*") and  (matchesphrase(jobstatus, "ENDED OK") OR matchesphrase(jobstatus, "ENDED NOTOK"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you can set some dimensions like timestamp, job, orderid ,runno and jobstatus.&lt;/P&gt;&lt;P&gt;You can use these dimensions to work on the metric selector and define the alerts rules by it.&lt;/P&gt;&lt;P&gt;Try and let us know.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 20:56:15 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236396#M626</guid>
      <dc:creator>dannemca</dc:creator>
      <dc:date>2024-02-06T20:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive a field in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236397#M627</link>
      <description>&lt;P&gt;Unfortunately only matcher is not giving the intended result as we need to identify the duration from start time to now(). We are looking for a solution where we would run this dql in certain time and then get the job run time and if any of them have run time more than 30 mins (not ended yet) then send an alert. Would workflow be appropriate for this kind of scenario ?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 22:28:47 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236397#M627</guid>
      <dc:creator>susmita_k</dc:creator>
      <dc:date>2024-02-06T22:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive a field in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236435#M629</link>
      <description>&lt;P&gt;Yep, that would be my next suggestion. You can create a workflow to run in a crontab way, that execute your DQL and then take some action based on its results.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 12:21:55 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236435#M629</guid>
      <dc:creator>dannemca</dc:creator>
      <dc:date>2024-02-07T12:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive a field in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236738#M638</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/18264"&gt;@dannemca&lt;/a&gt;,&amp;nbsp;workflow solution is working as expected.&amp;nbsp; On a different log content, I am tryin gto parse the content like "&lt;SPAN&gt;REPLACE_WEB_SERVICE_UI=TRUE" with below parse dql :&amp;nbsp;PARSE content, " DATA:propkey '=', DATA:propValue EOL;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, it does not seem to work. is there another way to find out the value from = to end of line ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 17:49:49 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236738#M638</guid>
      <dc:creator>susmita_k</dc:creator>
      <dc:date>2024-02-09T17:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive a field in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236741#M639</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;data record(content="REPLACE_WEB_SERVICE_UI=TRUE")
| parse content, "LD:key '=' LD:value"&lt;/LI-CODE&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image (15).png" style="width: 847px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/17512i44C3D71CEF7BD9D4/image-size/large?v=v2&amp;amp;px=999" role="button" title="image (15).png" alt="image (15).png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 17:57:11 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236741#M639</guid>
      <dc:creator>dannemca</dc:creator>
      <dc:date>2024-02-09T17:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive a field in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236743#M640</link>
      <description>&lt;P&gt;Thanks so much! works like a charm.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 18:15:32 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-derive-a-field-in-DQL/m-p/236743#M640</guid>
      <dc:creator>susmita_k</dc:creator>
      <dc:date>2024-02-09T18:15:32Z</dc:date>
    </item>
  </channel>
</rss>

