<?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 List log files for a metric in Log Analytics</title>
    <link>https://community.dynatrace.com/t5/Log-Analytics/List-log-files-for-a-metric/m-p/205804#M525</link>
    <description>&lt;P&gt;Good day.&lt;/P&gt;&lt;P&gt;We building a dashboard that will show the metrics for certain error conditions, with this we want to be able to have that log line to be available on the dashboard. Let me give a easy example. Lets say one of the metrics is to show if a "File not found". If there is a counter for it, we want to display or have a link to the log entry/s for that metric to for example see what file was not found in the log line.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this possible and if so, how would this be done?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Tue, 28 Feb 2023 07:42:02 GMT</pubDate>
    <dc:creator>Brandt74</dc:creator>
    <dc:date>2023-02-28T07:42:02Z</dc:date>
    <item>
      <title>List log files for a metric</title>
      <link>https://community.dynatrace.com/t5/Log-Analytics/List-log-files-for-a-metric/m-p/205804#M525</link>
      <description>&lt;P&gt;Good day.&lt;/P&gt;&lt;P&gt;We building a dashboard that will show the metrics for certain error conditions, with this we want to be able to have that log line to be available on the dashboard. Let me give a easy example. Lets say one of the metrics is to show if a "File not found". If there is a counter for it, we want to display or have a link to the log entry/s for that metric to for example see what file was not found in the log line.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this possible and if so, how would this be done?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 07:42:02 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Log-Analytics/List-log-files-for-a-metric/m-p/205804#M525</guid>
      <dc:creator>Brandt74</dc:creator>
      <dc:date>2023-02-28T07:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: List log files for a metric</title>
      <link>https://community.dynatrace.com/t5/Log-Analytics/List-log-files-for-a-metric/m-p/205837#M526</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/60127"&gt;@Brandt74&lt;/a&gt; there is an extension &lt;A href="https://www.dynatrace.com/hub/detail/filesystem-monitoring-extension-v2" target="_blank" rel="noopener"&gt;https://www.dynatrace.com/hub/detail/filesystem-monitoring-extension-v2&lt;/A&gt; which can be used to achieve this.&lt;/P&gt;&lt;DIV class=""&gt;&lt;P&gt;&lt;STRONG&gt;Metrics&lt;/STRONG&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;File count: Number of files matching a pattern&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;File age count: Number of files matching a pattern and an age&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;File age: Age of a specific file (oldest or newest when returning more than 1 file)&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;File size: Size of the files in bytes&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;File mounted: Is a file mounted on Unix NFS&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/DIV&gt;&lt;H2&gt;use cases&lt;/H2&gt;&lt;DIV class=""&gt;&lt;P&gt;&lt;STRONG&gt;Path examples:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Count the number of log files inside /var/log/myapp&lt;BR /&gt;Select check type = count&lt;BR /&gt;Path = /var/log/myapp/*.log&lt;/LI&gt;&lt;LI&gt;Count the number of log files inside c:\temp&lt;BR /&gt;Select check type = count&lt;BR /&gt;Path = c:\temp*.log&lt;/LI&gt;&lt;LI&gt;Count the number of logs files inside /var/log/myapp and any subdirectories&lt;BR /&gt;Select check type = count&lt;BR /&gt;Path = /var/log/myapp/**/*.log&lt;/LI&gt;&lt;LI&gt;Return the total size of all files files inside /var/log/myapp&lt;BR /&gt;Select check type = size&lt;BR /&gt;Path = /var/log/myapp/*&lt;/LI&gt;&lt;LI&gt;Return the age of the oldest file in /tmp/test/&lt;BR /&gt;Select check type = modification age&lt;BR /&gt;Unselect user newest file&lt;BR /&gt;Path = /tmp/test/*&lt;/LI&gt;&lt;LI&gt;Return the number of log files older than 1 hour in /tmp/test&lt;BR /&gt;Select check type = modification age count&lt;BR /&gt;Set Age comparison operator to Older than&lt;BR /&gt;Set the threshold to 60&lt;BR /&gt;Path = /tmp/test/*.log&lt;/LI&gt;&lt;LI&gt;Check if /data/mount-data is mounted&lt;BR /&gt;Select check type = mount point&lt;BR /&gt;Path = /data/mount-data&lt;/LI&gt;&lt;LI&gt;Check that today's log has been produced: /var/mylog20222211.log&lt;BR /&gt;Select check type = count&lt;BR /&gt;Path = /var/mylogYYYYMMDD.log&lt;BR /&gt;Accepts DDMMYYYY, DD-MM-YYYY, DD_MM_YYYY, YYYYMMDD. YYYY-MM-DD, YYYY_MM_DD.&lt;BR /&gt;The date will be the local date where the OneAgent/extension is running.&lt;/LI&gt;&lt;/UL&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 28 Feb 2023 12:29:16 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Log-Analytics/List-log-files-for-a-metric/m-p/205837#M526</guid>
      <dc:creator>DanielS</dc:creator>
      <dc:date>2023-02-28T12:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: List log files for a metric</title>
      <link>https://community.dynatrace.com/t5/Log-Analytics/List-log-files-for-a-metric/m-p/205918#M527</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/60127"&gt;@Brandt74&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Another solution, Switch on log monitoring v2. Set the log source where you would like to search the "file not found" pattern.&lt;/P&gt;&lt;P&gt;At the log viewer set a filter for the log content pattern "file not found" then:&lt;/P&gt;&lt;P&gt;You can create a log metric with the peviously mentioned log filter. Now your "file not found" log lines will be counted. You can vizualize this metric or you can create an alert for the metric.&amp;nbsp;&lt;/P&gt;&lt;P&gt;or You can pin the log filter result to a dashboard, so you can see the filtered log lines on the dashboard.&lt;/P&gt;&lt;P&gt;Regarding the what file question: If you can define well the location of the file name in the log line, you can parse out from the logline with a simple log processing.&lt;/P&gt;&lt;P&gt;Some example:&lt;/P&gt;&lt;P&gt;Simple filter in log viewer for file not found log lines, result can be pinned to a dashboard.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mizs_0-1677623068004.png" style="width: 597px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/10188i620E98BB8ED33CEE/image-dimensions/597x218?v=v2" width="597" height="218" role="button" title="Mizs_0-1677623068004.png" alt="Mizs_0-1677623068004.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Simple log metric with source and content pattern:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mizs_1-1677623258953.png" style="width: 650px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/10189iBD6E5970A0457B3C/image-dimensions/650x335?v=v2" width="650" height="335" role="button" title="Mizs_1-1677623258953.png" alt="Mizs_1-1677623258953.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Simple parse a log attribute. Result obm.type value will&amp;nbsp; be propagated based on the log contet after Type:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mizs_2-1677623449111.png" style="width: 693px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/10190iC2C96AA19B3F13C8/image-dimensions/693x201?v=v2" width="693" height="201" role="button" title="Mizs_2-1677623449111.png" alt="Mizs_2-1677623449111.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Above processing rule results in the log viewer if "Type:" is found in a log line:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mizs_3-1677623765247.png" style="width: 681px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/10191iD5F57C00966644EE/image-dimensions/681x371?v=v2" width="681" height="371" role="button" title="Mizs_3-1677623765247.png" alt="Mizs_3-1677623765247.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Extra tip: log attributes can be dimensions at a more complex log metric:&lt;/P&gt;&lt;P&gt;At this log metic the error lines counted and the additional dimension is also added. So in data explorer you can split or filer by log attributes (by dimensions)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mizs_4-1677624129924.png" style="width: 714px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/10192iCBB851AD43236EF7/image-dimensions/714x530?v=v2" width="714" height="530" role="button" title="Mizs_4-1677624129924.png" alt="Mizs_4-1677624129924.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here is a simple example for log monitoring dashboard:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mizs_5-1677625200764.png" style="width: 686px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/10193i95C26DDCBE00A0D5/image-dimensions/686x314?v=v2" width="686" height="314" role="button" title="Mizs_5-1677625200764.png" alt="Mizs_5-1677625200764.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I hope it helps.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Mizső&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 23:06:47 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Log-Analytics/List-log-files-for-a-metric/m-p/205918#M527</guid>
      <dc:creator>Mizső</dc:creator>
      <dc:date>2023-02-28T23:06:47Z</dc:date>
    </item>
  </channel>
</rss>

