<?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 use chart command to get data over 3 variables in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-chart-command-to-get-data-over-3-variables/m-p/328878#M97898</link>
    <description>&lt;P&gt;Thanks Niket for help .. Appreciate .. With minor changes in query it works exactly i needed .&lt;/P&gt;</description>
    <pubDate>Sun, 29 Oct 2017 03:26:30 GMT</pubDate>
    <dc:creator>atulitm</dc:creator>
    <dc:date>2017-10-29T03:26:30Z</dc:date>
    <item>
      <title>How to use chart command to get data over 3 variables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-chart-command-to-get-data-over-3-variables/m-p/328875#M97895</link>
      <description>&lt;P&gt;day_receive_time="Wed, Oct 25, 2017" device_name="apple" app="mssql-db" bandwidth_consumption="161" &lt;BR /&gt;
day_receive_time="Wed, Oct 25, 2017" device_name="apple" app="ldap" bandwidth_consumption="146" &lt;BR /&gt;
day_receive_time="Wed, Oct 25, 2017" device_name="grape" app="syslog" bandwidth_consumption="69" &lt;BR /&gt;
day_receive_time="Wed, Oct 25, 2017" device_name="grape" app="syslog" bandwidth_consumption="69"&lt;BR /&gt;
day_receive_time="Wed, Oct 25, 2017" device_name="grape" app="abc" bandwidth_consumption="80"&lt;BR /&gt;
day_receive_time="Thurs, Oct 26, 2017" device_name="apple" app="mssql-db" bandwidth_consumption="164" &lt;BR /&gt;
day_receive_time="Thurs, Oct 26, 2017" device_name="apple" app="ldap" bandwidth_consumption="146" &lt;BR /&gt;
day_receive_time="Thurs, Oct 26, 2017" device_name="grape" app="syslog" bandwidth_consumption="69" &lt;BR /&gt;
day_receive_time="Thurs, Oct 26, 2017" device_name="grape" app="syslog" bandwidth_consumption="69"&lt;BR /&gt;
day_receive_time="Thurs, Oct 26, 2017" device_name="grape" app="abc" bandwidth_consumption="80"&lt;/P&gt;

&lt;P&gt;Trying to get data as shown in snippet :&lt;BR /&gt;
device_name app bandwidth_consumption&lt;BR /&gt;
Wed, Oct 25, 2017 Thurs, Oct 26, 2017 &lt;BR /&gt;
apple mssql-db 161 120&lt;BR /&gt;
ldap 146 132&lt;BR /&gt;
syslog 69 85&lt;BR /&gt;
grape syslog 69 80&lt;/P&gt;

&lt;P&gt;index | chart values(app) AS app values(bandwidth_consumption) AS bandwidth_consumption by device_name day_receive_time&lt;BR /&gt;
this gives me desired results but problem is it creates column for app too per day where i need to see app and then how much bandwidth_consumption per day as shown above .&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:26:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-chart-command-to-get-data-over-3-variables/m-p/328875#M97895</guid>
      <dc:creator>atulitm</dc:creator>
      <dc:date>2020-09-29T16:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to use chart command to get data over 3 variables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-chart-command-to-get-data-over-3-variables/m-p/328876#M97896</link>
      <description>&lt;P&gt;I'm going to throw this out there - I am finding it difficult to envision what you want, but maybe ---&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your Search | timechart sum(bandwidth_consumption)  by day_receive_time, device_name, app
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If that works, great.  &lt;/P&gt;

&lt;P&gt;If not, can you please mock up a little table of how you'd like the results?  While it's not perfect and that will be OK, could you remember to use the code button (101010) in the tool bar to try formatting it into columns and rows?&lt;/P&gt;</description>
      <pubDate>Sat, 28 Oct 2017 12:39:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-chart-command-to-get-data-over-3-variables/m-p/328876#M97896</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2017-10-28T12:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to use chart command to get data over 3 variables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-chart-command-to-get-data-over-3-variables/m-p/328877#M97897</link>
      <description>&lt;P&gt;@atulitm, please Try the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt;
| eval key=device_name."-".app
| eval day_receive_time=strptime(day_receive_time,"%a, %b %d, %Y")
|  eval _time=strftime(_time,"%y-%m-%d") 
| chart last(bandwidth_condumption) as bandwidth_consumption over key by day_receive_time cont=f
| fillnull value=0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;strpttime()&lt;/CODE&gt; function is used to convert your String Time to Epoch and then later it is used to convert to String Time as &lt;CODE&gt;YY-mm-dd&lt;/CODE&gt; using &lt;CODE&gt;strftime()&lt;/CODE&gt; function. This format helps sort the time while keeping the format short (seems like you do need only date precision not time). Chart is used to plot Time on y-axis and &lt;CODE&gt;key&lt;/CODE&gt; formed by combining &lt;CODE&gt;device_name&lt;/CODE&gt; and &lt;CODE&gt;app&lt;/CODE&gt; name on the x-axis. If you need to reverse for charting purpose you can switch the fields in &lt;CODE&gt;over&lt;/CODE&gt; and &lt;CODE&gt;by&lt;/CODE&gt; clause of &lt;CODE&gt;chart&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Following is a run anywhere search on similar lines based on Splunk's _internal index to test out the same:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype=splunkd log_level!="INFO"
|  eval key =log_level."-".host
|  eval _time=strftime(_time,"%y-%m-%d")
|  chart last(date_second) as date_seconds over key by _time cont=f
|  fillnull value=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Oct 2017 21:25:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-chart-command-to-get-data-over-3-variables/m-p/328877#M97897</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-10-28T21:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to use chart command to get data over 3 variables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-chart-command-to-get-data-over-3-variables/m-p/328878#M97898</link>
      <description>&lt;P&gt;Thanks Niket for help .. Appreciate .. With minor changes in query it works exactly i needed .&lt;/P&gt;</description>
      <pubDate>Sun, 29 Oct 2017 03:26:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-chart-command-to-get-data-over-3-variables/m-p/328878#M97898</guid>
      <dc:creator>atulitm</dc:creator>
      <dc:date>2017-10-29T03:26:30Z</dc:date>
    </item>
  </channel>
</rss>

