<?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: Disk Space Pie Charts from &amp;quot;df&amp;quot; Script in UNIX App in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88250#M22567</link>
    <description>&lt;P&gt;Thank you!!&lt;/P&gt;</description>
    <pubDate>Wed, 16 Jan 2013 16:21:43 GMT</pubDate>
    <dc:creator>aferone</dc:creator>
    <dc:date>2013-01-16T16:21:43Z</dc:date>
    <item>
      <title>Disk Space Pie Charts from "df" Script in UNIX App</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88243#M22560</link>
      <description>&lt;P&gt;I'd like to set up pie charts for disk space from data coming from the "df" scripts from the UNIX app.  In looking through the charting docs, I can see how to chart "count" data, but I am unclear how to chart a single value, coming from the "df" script.  I tried the "transpose" command, but only "UsedG" is coming up on the chart.&lt;/P&gt;

&lt;P&gt;The search below was developed with help from the Splunk Answers KB.  Notice that we convert the "Used" field to gigabytes.  It goes to a field called "UsedG", but this seems to screw up the table.  It adds "UsedG" to the table, even though it is not defined in the search.&lt;/P&gt;

&lt;P&gt;I basically want to use "Used" and "Available", which should give a complete pie chart.  If there was a way to chart "Size" and "Used", that would probably be more accurate.&lt;/P&gt;

&lt;P&gt;Thanks for the help!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host="myhost" sourcetype="df" 
| multikv fields Filesystem Type Size Used Avail UsePct MountedOn 
| search /home | table MountedOn Size Used Avail 
| eval UsedG = case(match(Used,"[M]"),round(tonumber(rtrim(Used,"M"))/1024,3),
       match(Used,"[T]"),round(tonumber(rtrim(Used,"T"))*1024,3),
       match(Used,"[G]"),round(tonumber(rtrim(Used,"G")),3))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Jan 2013 18:31:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88243#M22560</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2013-01-15T18:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Disk Space Pie Charts from "df" Script in UNIX App</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88244#M22561</link>
      <description>&lt;P&gt;For starters, use |convert to normalize those values instead of that eval.&lt;/P&gt;

&lt;P&gt;I would also drop that table command.&lt;/P&gt;

&lt;P&gt;And you probably only want the most recent value, but you want all filesystems.&lt;/P&gt;

&lt;P&gt;Finally, you need to actually chart the data.&lt;/P&gt;

&lt;P&gt;So what we're left with is something like this:&lt;BR /&gt;
    host="myhost" sourcetype="df"&lt;BR /&gt;
    | head 1&lt;BR /&gt;
    | multikv fields Filesystem Type Size Used Avail UsePct MountedOn&lt;BR /&gt;
    | convert memk(Used)&lt;BR /&gt;
    | chart avg(Used) AS Used by Filesystem&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2013 20:16:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88244#M22561</guid>
      <dc:creator>christopher_hod</dc:creator>
      <dc:date>2013-01-15T20:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: Disk Space Pie Charts from "df" Script in UNIX App</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88245#M22562</link>
      <description>&lt;P&gt;(Updated with convert command instead of eval, and explanation - also updated to address "every 5 minute" problem)&lt;BR /&gt;
My first question is - so why do you calculate UsedG if you never want to use it?&lt;/P&gt;

&lt;P&gt;This will get your pie chart&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host="myhost" sourcetype="df" earliest=-10m
| multikv fields Used Avail MountedOn
| search /home 
| dedup MountedOn
| eval s = "Used,Available"
| makemv delim="," allowempty=t s
| mvexpand s
| eval Size = if(s=="Used",Used,Avail)
| convert memk(Size) as Size 
| chart sum(Size) as "Size in Gb" by s
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Try this for a column chart:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host="myhost" sourcetype="df" 
| multikv fields Filesystem Type Size Used Avail UsePct MountedOn 
| dedup MountedOn
| eval s = "Used,TotalSize"
| makemv delim="," allowempty=t s
| mvexpand s
| eval Size = if(s=="Used",Used,Size)
| convert memk(Size) as Size 
| chart sum(Size) as "Size in Gb" by MountedOn, s
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Explanation by line -&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;host="myhost" sourcetype="df"&lt;BR /&gt;&lt;BR /&gt;
| multikv fields Filesystem Type Size Used Avail UsePct MountedOn&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;
The initial search and field extraction&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;| eval s = "Used,TotalSize"&lt;BR /&gt;&lt;BR /&gt;
| makemv delim="," allowempty=t s&lt;BR /&gt;&lt;BR /&gt;
| mvexpand s&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;
Create a new variable s that contains 2 values. Tell Splunk to consider this a multi-valued field. Expand this event into two events, one for each value of &lt;CODE&gt;s&lt;/CODE&gt;. Except for that, the events are the same. This turns &lt;CODE&gt;s&lt;/CODE&gt; back into a single-valued field, but creates multiple events.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;| eval Size = if(s=="Used",Used,Size)&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;
Set the variable Size to the amount of disk used, when the field &lt;CODE&gt;s&lt;/CODE&gt; refers to "used". Otherwise, the field is the total size, so use the original Size field&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;| convert memk(Size) as Size&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;
Convert the Size into a true numeric field, representing KB&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;| chart sum(Size) as "Size in Gb" by MountedOn, s&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;
 Chart the size field, breaking it down by mount point, and within that by Used and TotalSize. If you chart this using a column chart, you can see the two bars side-by-side.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2013 20:24:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88245#M22562</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-01-15T20:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: Disk Space Pie Charts from "df" Script in UNIX App</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88246#M22563</link>
      <description>&lt;P&gt;I actually used "UsedG" for a different report.&lt;/P&gt;

&lt;P&gt;I need to lookup some of the terms you used.  I've never seen them before.  I am still a noob in many ways!&lt;/P&gt;

&lt;P&gt;This works great!  Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2013 20:37:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88246#M22563</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2013-01-15T20:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: Disk Space Pie Charts from "df" Script in UNIX App</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88247#M22564</link>
      <description>&lt;P&gt;Thanks for your answer!  I learned some new terms from your input.  Thanks again!&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2013 20:38:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88247#M22564</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2013-01-15T20:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: Disk Space Pie Charts from "df" Script in UNIX App</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88248#M22565</link>
      <description>&lt;P&gt;Can you just quickly breakdown how this works?  I appreciate it!&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2013 20:41:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88248#M22565</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2013-01-15T20:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: Disk Space Pie Charts from "df" Script in UNIX App</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88249#M22566</link>
      <description>&lt;P&gt;Nice use of the memk function!&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2013 23:19:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88249#M22566</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-01-15T23:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: Disk Space Pie Charts from "df" Script in UNIX App</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88250#M22567</link>
      <description>&lt;P&gt;Thank you!!&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2013 16:21:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88250#M22567</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2013-01-16T16:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: Disk Space Pie Charts from "df" Script in UNIX App</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88251#M22568</link>
      <description>&lt;P&gt;So, now that I matching up the numbers from the chart and the actual log, they aren't matching up. I'm getting completely different results.  The chart works, but it's the wrong values entirely.  The search below christipherhodson brings back the right values, but just the Used values, and not total disk space.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2013 16:39:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88251#M22568</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2013-01-16T16:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: Disk Space Pie Charts from "df" Script in UNIX App</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88252#M22569</link>
      <description>&lt;P&gt;Weird, sounds like maybe something is up with the multikv&lt;/P&gt;

&lt;P&gt;You might try just running this to see if the extracted values are correct:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;host="myhost" sourcetype="df" &lt;BR /&gt;
| multikv fields Filesystem Type Size Used Avail UsePct MountedOn &lt;BR /&gt;
| table fields Filesystem Type Size Used Avail UsePct MountedOn&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2013 20:31:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88252#M22569</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-01-16T20:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: Disk Space Pie Charts from "df" Script in UNIX App</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88253#M22570</link>
      <description>&lt;P&gt;Thanks for replying again.  Yes, all the values are correct.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2013 20:35:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88253#M22570</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2013-01-16T20:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: Disk Space Pie Charts from "df" Script in UNIX App</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88254#M22571</link>
      <description>&lt;P&gt;I am going to post another "answer" below so that I can provide screenshots.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2013 20:37:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88254#M22571</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2013-01-16T20:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Disk Space Pie Charts from "df" Script in UNIX App</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88255#M22572</link>
      <description>&lt;P&gt;This is what "df" is returning:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://splunk-base.splunk.com//storage/raw.gif" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;And this is what the query returns:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://splunk-base.splunk.com//storage/results.gif" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2013 20:39:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88255#M22572</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2013-01-16T20:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: Disk Space Pie Charts from "df" Script in UNIX App</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88256#M22573</link>
      <description>&lt;P&gt;It actually ended up above, since it is my own question.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2013 20:41:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88256#M22573</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2013-01-16T20:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: Disk Space Pie Charts from "df" Script in UNIX App</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88257#M22574</link>
      <description>&lt;P&gt;I think I see what is happening.  I had the time frame set to 1 hour, and the "df" command runs every 5 minutes.  the query is adding together all of the "df" findings.  How would I pull only the latest record, without having to rely on a timeframe?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2013 20:54:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88257#M22574</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2013-01-16T20:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: Disk Space Pie Charts from "df" Script in UNIX App</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88258#M22575</link>
      <description>&lt;P&gt;That's why I used the "|head 1" in my answer below.  You could also use the latest() function.&lt;/P&gt;

&lt;P&gt;FYI, if you want to use a pie chart, you're only going to want one value per filesystem.&lt;/P&gt;

&lt;P&gt;You could also do one pie chart per filesystem, but that's more complex&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2013 12:25:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88258#M22575</guid>
      <dc:creator>christopher_hod</dc:creator>
      <dc:date>2013-01-17T12:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Disk Space Pie Charts from "df" Script in UNIX App</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88259#M22576</link>
      <description>&lt;P&gt;Cool.  Thanks, Chris!&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2013 15:10:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88259#M22576</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2013-01-17T15:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Disk Space Pie Charts from "df" Script in UNIX App</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88260#M22577</link>
      <description>&lt;P&gt;Do we need to write a stanza seperately for inputs.conf  in the host server ?&lt;BR /&gt;
if so can you send me the stanza for getting df -h command data and ls -l command data.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 15:54:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Disk-Space-Pie-Charts-from-quot-df-quot-Script-in-UNIX-App/m-p/88260#M22577</guid>
      <dc:creator>abhay24</dc:creator>
      <dc:date>2016-07-20T15:54:14Z</dc:date>
    </item>
  </channel>
</rss>

