<?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: Directory Size Question in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Directory-Size-Question/m-p/86537#M4710</link>
    <description>&lt;P&gt;Please post a sample event or two.  Without knowing exactly what format your seeing (and how your events are being broken up), it's difficult to provide a good example search.  (You can add this to your existing question, using the "edit" link.  (Indent 4 spaces to prevent any weird formatting.)&lt;/P&gt;</description>
    <pubDate>Wed, 10 Nov 2010 07:35:26 GMT</pubDate>
    <dc:creator>Lowell</dc:creator>
    <dc:date>2010-11-10T07:35:26Z</dc:date>
    <item>
      <title>Directory Size Question</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Directory-Size-Question/m-p/86536#M4709</link>
      <description>&lt;P&gt;Currently I have a simple perl script set up to email me if a couple directories get above a certain quota along with a couple other warnings. That's all good but I'd like to move this monitoring into splunk. So I guess my question would be what would be the best way to do that?&lt;/P&gt;

&lt;P&gt;I tried creating a simple log with a script that is simply &lt;CODE&gt;du -s --exclude=.* /directory &amp;gt;&amp;gt; $LOGFILE&lt;/CODE&gt; and I can get splunk to index it easy enough but I'm at a loss on what to do after that. How would I compose a search that would set up a timechart with multiple lines(each line being a monitored directory)?&lt;/P&gt;

&lt;P&gt;I've been playing with setting up different dashboards but I think I'm just missing either how to form the search query or how to set up a more sophisticated log.&lt;/P&gt;

&lt;P&gt;I've been reading through alot of the documentation and have no problem doing so, therefore if this is outlined somewhere else please point me in that direction. &lt;/P&gt;

&lt;P&gt;Also I'm using the *NIX app.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2010 01:20:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Directory-Size-Question/m-p/86536#M4709</guid>
      <dc:creator>nse</dc:creator>
      <dc:date>2010-11-10T01:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: Directory Size Question</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Directory-Size-Question/m-p/86537#M4710</link>
      <description>&lt;P&gt;Please post a sample event or two.  Without knowing exactly what format your seeing (and how your events are being broken up), it's difficult to provide a good example search.  (You can add this to your existing question, using the "edit" link.  (Indent 4 spaces to prevent any weird formatting.)&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2010 07:35:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Directory-Size-Question/m-p/86537#M4710</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-11-10T07:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: Directory Size Question</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Directory-Size-Question/m-p/86538#M4711</link>
      <description>&lt;P&gt;Here are some thoughts...&lt;/P&gt;

&lt;P&gt;Ok some basics, you should be able to pull your event into a simple table using something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=/path/to/your/logfile | rex "^(?&amp;lt;total_kb&amp;gt;\d+)\s+(?&amp;lt;path&amp;gt;/.*)$" | table _time, path, total_kb
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now, if you want to do some visual trend analysis, a simple "timechart" search should do the trick:  (You'll need to switch to a charting view to see this as a graph.  Click the "show report" link.)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=/path/to/your/logfile | rex "^(?&amp;lt;total_kb&amp;gt;\d+)\s+(?&amp;lt;path&amp;gt;/.*)$" | timechart avg(eval(total_kb/1024)) as total_mb by path
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now, if you want to get more fancy and setup some size limits, so you only see events where the size is exceeded; you could use a search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=/path/to/your/logfile | rex "^(?&amp;lt;total_kb&amp;gt;\d+)\s+(?&amp;lt;path&amp;gt;/.*)$" | eval limit_kb=case(path=="/home/user", 100000, path=="/mnt/backup", 10000000, 0==0, 50000) | where total_kb &amp;gt; limit
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;BLOCKQUOTE&gt;
  &lt;P&gt;Notice that the &lt;CODE&gt;0==0&lt;/CODE&gt; is always true; so basically this is saying use 50000 as the default limit for any path other than the two explicitly listed.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;I hope that gives you some ideas on how to get started.  I've made some basic assumptions about how your events will probably look based on running &lt;CODE&gt;du -s&lt;/CODE&gt; on my system, but the regex may be different for you.&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Here are some takeaways, (aka homework), if your interested...&lt;/P&gt;

&lt;P&gt;1.)  Figure out how to get the regular expression show above into a configuration file so you don't need to use a "rex" command for all of your searches.  (Hint:  check out the &lt;CODE&gt;EXTRACT&lt;/CODE&gt; entry in the &lt;CODE&gt;props.conf&lt;/CODE&gt; file)&lt;/P&gt;

&lt;P&gt;2.)  See if you can setup those per-path limits in a lookup file.  This way you can have a simple CSV file where you store all your paths, and the size limits for each path.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2010 07:55:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Directory-Size-Question/m-p/86538#M4711</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-11-10T07:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: Directory Size Question</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Directory-Size-Question/m-p/86539#M4712</link>
      <description>&lt;P&gt;Thanks, for the excellent response. I am using just du -s so I will give this a try and respond back.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2010 04:30:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Directory-Size-Question/m-p/86539#M4712</guid>
      <dc:creator>nse</dc:creator>
      <dc:date>2010-11-12T04:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Directory Size Question</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Directory-Size-Question/m-p/86540#M4713</link>
      <description>&lt;P&gt;Alright so would the "^(?&lt;TOTAL_KB&gt;\d+)\s+(?&lt;PATH&gt;/.*)$" the param for BREAK_ONLY_BEFORE in the props.conf?&lt;/PATH&gt;&lt;/TOTAL_KB&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:20:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Directory-Size-Question/m-p/86540#M4713</guid>
      <dc:creator>nse</dc:creator>
      <dc:date>2020-09-28T09:20:45Z</dc:date>
    </item>
    <item>
      <title>Re: Directory Size Question</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Directory-Size-Question/m-p/86541#M4714</link>
      <description>&lt;P&gt;You could use &lt;CODE&gt;BREAK_ONLY_BEFORE&lt;/CODE&gt;, however, a much simpler and better approach would be to simply set &lt;CODE&gt;SHOULD_LINEMERGE=False&lt;/CODE&gt; which means that each line will become it's own event; which I think is all you want this case.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2010 22:07:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Directory-Size-Question/m-p/86541#M4714</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-11-12T22:07:03Z</dc:date>
    </item>
  </channel>
</rss>

