<?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: Convert Log query to log metric event for alerting in Alerting</title>
    <link>https://community.dynatrace.com/t5/Alerting/Convert-Log-query-to-log-metric-event-for-alerting/m-p/267152#M5371</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/59572"&gt;@rpeng&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;As far as I understood your query, you should use summarize to get the count of errors and then split using dimensions.&lt;BR /&gt;Below is a sample:&lt;BR /&gt;&lt;BR /&gt;fetch logs&lt;BR /&gt;| filter loglevel == "ERROR"&lt;BR /&gt;| summarize count(), by: {dt.entity.host,log.source}&lt;BR /&gt;&lt;BR /&gt;Later, while setting the alert definition you can set the 1 minute interval to check the count of errors.&lt;BR /&gt;&lt;A href="https://docs.dynatrace.com/docs/shortlink/lma-e2e-create-anomaly-detection-metric#create-alert" target="_blank"&gt;https://docs.dynatrace.com/docs/shortlink/lma-e2e-create-anomaly-detection-metric#create-alert&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 11 Jan 2025 01:09:20 GMT</pubDate>
    <dc:creator>RohitBisht</dc:creator>
    <dc:date>2025-01-11T01:09:20Z</dc:date>
    <item>
      <title>Convert Log query to log metric event for alerting</title>
      <link>https://community.dynatrace.com/t5/Alerting/Convert-Log-query-to-log-metric-event-for-alerting/m-p/267150#M5370</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;Hello,&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;P&gt;We need to create a log metric to track the number of errors per minute, and then we can create a metric event that triggers if the number of errors is &amp;gt; some value for more than X minutes in the last X minutes.&amp;nbsp; This should then create a problem card if there are errors and then we can create alerts off of that problem card.&lt;/P&gt;&lt;P&gt;Query:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;fetch logs //, scanLimitGBytes: 500, samplingRatio: 1000&lt;BR /&gt;| filter matchesValue(dt.kubernetes.cluster.name, "dynakube-prd-centralus-plum-app-k8s") or matchesValue(dt.kubernetes.cluster.name, "dynakube-prd-eastus2-plum-app-k8s")&lt;BR /&gt;| filter matchesValue(k8s.deployment.name, "claims-ai-svc-claims-ai-helm-*")&lt;BR /&gt;| filter k8s.container.name == "claims-ai-helm"&amp;nbsp;&lt;BR /&gt;| sort timestamp desc&lt;BR /&gt;| parse content, "JSON:json"&lt;BR /&gt;| filter json[level] == "error"&lt;BR /&gt;| fields&amp;nbsp; timestamp ,json[level],json[data][msg],json[context], json[aiClaimId],content,json[hostname]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am creating the new log processing rule but I am unable to set the correct processor definition in addition to the Matcher as my query above has several filters. Can someone assist me with corrections? Following documentation here:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://docs.dynatrace.com/docs/analyze-explore-automate/logs/lma-use-cases/lma-e2e-create-anomaly-detection-metric" target="_blank" rel="noopener"&gt;Create anomaly detection metric — Dynatrace Docs&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Currently i'm using the last matchesValue:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;matchesValue(k8s.deployment.name, "claims-ai-svc-claims-ai-helm-*")&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 10 Jan 2025 22:14:18 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Alerting/Convert-Log-query-to-log-metric-event-for-alerting/m-p/267150#M5370</guid>
      <dc:creator>rpeng</dc:creator>
      <dc:date>2025-01-10T22:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Log query to log metric event for alerting</title>
      <link>https://community.dynatrace.com/t5/Alerting/Convert-Log-query-to-log-metric-event-for-alerting/m-p/267152#M5371</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/59572"&gt;@rpeng&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;As far as I understood your query, you should use summarize to get the count of errors and then split using dimensions.&lt;BR /&gt;Below is a sample:&lt;BR /&gt;&lt;BR /&gt;fetch logs&lt;BR /&gt;| filter loglevel == "ERROR"&lt;BR /&gt;| summarize count(), by: {dt.entity.host,log.source}&lt;BR /&gt;&lt;BR /&gt;Later, while setting the alert definition you can set the 1 minute interval to check the count of errors.&lt;BR /&gt;&lt;A href="https://docs.dynatrace.com/docs/shortlink/lma-e2e-create-anomaly-detection-metric#create-alert" target="_blank"&gt;https://docs.dynatrace.com/docs/shortlink/lma-e2e-create-anomaly-detection-metric#create-alert&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jan 2025 01:09:20 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Alerting/Convert-Log-query-to-log-metric-event-for-alerting/m-p/267152#M5371</guid>
      <dc:creator>RohitBisht</dc:creator>
      <dc:date>2025-01-11T01:09:20Z</dc:date>
    </item>
  </channel>
</rss>

