<?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: Can you help me answer a question with the chart command? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-answer-a-question-with-the-chart-command/m-p/443260#M125774</link>
    <description>&lt;P&gt;@krusovice &lt;/P&gt;

&lt;P&gt;Can you please try this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* sourcetype=* 
| eval date_hour=if(len(date_hour)==1,"0".date_hour.":00",date_hour.":00") 
| rex "Total1\:\s(?&amp;lt;total1&amp;gt;[\d+]+)" 
| rex "Total2\:\s(?&amp;lt;total2&amp;gt;[\d+]+)" 
| stats count(total1) as total1, count(total2) as total2 by date_hour,sourcetype 
| eval granttotal = total1+total2 
| fields - _time 
| chart values(granttotal) over date_hour by sourcetype | transpose header_field=date_hour
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I did some minor correction in your search and added &lt;CODE&gt;sourcetype&lt;/CODE&gt; in &lt;CODE&gt;stats&lt;/CODE&gt;. I think following search not getting &lt;CODE&gt;sourcetype&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Please try and let me know.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Fri, 21 Dec 2018 12:02:22 GMT</pubDate>
    <dc:creator>kamlesh_vaghela</dc:creator>
    <dc:date>2018-12-21T12:02:22Z</dc:date>
    <item>
      <title>Can you help me answer a question with the chart command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-answer-a-question-with-the-chart-command/m-p/443255#M125769</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;

&lt;P&gt;I have this query formed and I can't the get expected result, but it's very close to what I want. The result of chart followed by transpose command is looking good, but under "column", I'm getting the value as NULL instead of "sourcetype". May I know how to fix it?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* sourcetype=*
| eval date_hour=if(len(date_hour)==1,"0".date_hour.":00",date_hour.":00")
| rex  "Total1\:\s(?&amp;lt;total1&amp;gt;[\d+]+)" 
| rex  "Total2\:\s(?&amp;lt;total2&amp;gt;[\d+]+)" 
| stats count(total1) count(total2) by date_hour
| eval granttotal = total1+total2
| fields - _time
| chart values(granttotal) over date_hour by sourcetype
| transpose header_field=date_hour

column       02:00         03:00         04:00
NULL           96.64         80.00         89.70
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Dec 2018 03:18:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-answer-a-question-with-the-chart-command/m-p/443255#M125769</guid>
      <dc:creator>krusovice</dc:creator>
      <dc:date>2018-12-21T03:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me answer a question with the chart command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-answer-a-question-with-the-chart-command/m-p/443256#M125770</link>
      <description>&lt;P&gt;fillnull works fine with chart command.. not sure about transpose. anyhow, lets try:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index=* sourcetype=*&lt;BR /&gt;
 | eval date_hour=if(len(date_hour)==1,"0".date_hour.":00",date_hour.":00")&lt;BR /&gt;
 | rex  "Total1\:\s(?[\d+]+)" &lt;BR /&gt;
 | rex  "Total2\:\s(?[\d+]+)" &lt;BR /&gt;
 | stats count(total1) count(total2) by date_hour&lt;BR /&gt;
 | eval granttotal = total1+total2&lt;BR /&gt;
 | fields - _time&lt;BR /&gt;
 | chart values(granttotal) over date_hour by sourcetype&lt;BR /&gt;
 | transpose header_field=date_hour &lt;BR /&gt;
 | fillnull value=sourcetype&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Fillnull"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Fillnull&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Dec 2018 04:16:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-answer-a-question-with-the-chart-command/m-p/443256#M125770</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2018-12-21T04:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me answer a question with the chart command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-answer-a-question-with-the-chart-command/m-p/443257#M125771</link>
      <description>&lt;P&gt;Thanks for reply, I've moved the fillnull before and after transpose, it is not working.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Dec 2018 05:43:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-answer-a-question-with-the-chart-command/m-p/443257#M125771</guid>
      <dc:creator>krusovice</dc:creator>
      <dc:date>2018-12-21T05:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me answer a question with the chart command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-answer-a-question-with-the-chart-command/m-p/443258#M125772</link>
      <description>&lt;P&gt;for this search, what output you get(without the transpose):&lt;BR /&gt;
&lt;CODE&gt;index=* sourcetype=*&lt;BR /&gt;
 | eval date_hour=if(len(date_hour)==1,"0".date_hour.":00",date_hour.":00")&lt;BR /&gt;
 | rex  "Total1\:\s(?[\d+]+)" &lt;BR /&gt;
 | rex  "Total2\:\s(?[\d+]+)" &lt;BR /&gt;
 | stats count(total1) count(total2) by date_hour&lt;BR /&gt;
 | eval granttotal = total1+total2&lt;BR /&gt;
 | fields - _time&lt;BR /&gt;
 | chart values(granttotal) over date_hour by sourcetype&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Dec 2018 06:44:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-answer-a-question-with-the-chart-command/m-p/443258#M125772</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2018-12-21T06:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me answer a question with the chart command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-answer-a-question-with-the-chart-command/m-p/443259#M125773</link>
      <description>&lt;P&gt;I'm having result as below:&lt;BR /&gt;
    date_hour         NULL&lt;BR /&gt;
    06:00                  78.00&lt;BR /&gt;
    07:00                  73.68&lt;/P&gt;</description>
      <pubDate>Fri, 21 Dec 2018 07:02:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-answer-a-question-with-the-chart-command/m-p/443259#M125773</guid>
      <dc:creator>krusovice</dc:creator>
      <dc:date>2018-12-21T07:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me answer a question with the chart command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-answer-a-question-with-the-chart-command/m-p/443260#M125774</link>
      <description>&lt;P&gt;@krusovice &lt;/P&gt;

&lt;P&gt;Can you please try this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* sourcetype=* 
| eval date_hour=if(len(date_hour)==1,"0".date_hour.":00",date_hour.":00") 
| rex "Total1\:\s(?&amp;lt;total1&amp;gt;[\d+]+)" 
| rex "Total2\:\s(?&amp;lt;total2&amp;gt;[\d+]+)" 
| stats count(total1) as total1, count(total2) as total2 by date_hour,sourcetype 
| eval granttotal = total1+total2 
| fields - _time 
| chart values(granttotal) over date_hour by sourcetype | transpose header_field=date_hour
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I did some minor correction in your search and added &lt;CODE&gt;sourcetype&lt;/CODE&gt; in &lt;CODE&gt;stats&lt;/CODE&gt;. I think following search not getting &lt;CODE&gt;sourcetype&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Please try and let me know.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 21 Dec 2018 12:02:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-answer-a-question-with-the-chart-command/m-p/443260#M125774</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-12-21T12:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me answer a question with the chart command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-answer-a-question-with-the-chart-command/m-p/443261#M125775</link>
      <description>&lt;P&gt;You have many mistakes.  See this run-anywhere fixed example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_* 
| eval date_hour=strftime(_time, "%H") 
| eval date_hour=if(len(date_hour)==1,"0".date_hour.":00",date_hour.":00") 
| eval total1=random(), total2=random()
| stats sum(total1) AS total1 sum(total2) AS total2 BY date_hour sourcetype
| eval grand_total = total1 + total2 
| chart values(grand_total) OVER date_hour BY sourcetype 
| transpose header_field=date_hour
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which means your fixed search &lt;EM&gt;should&lt;/EM&gt; be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* sourcetype=*
| eval date_hour=strftime(_time, "%H") 
| eval date_hour=if(len(date_hour)==1,"0".date_hour.":00",date_hour.":00")
| rex  "Total1\:\s(?&amp;lt;total1&amp;gt;[\d+]+)" 
| rex  "Total2\:\s(?&amp;lt;total2&amp;gt;[\d+]+)" 
| stats sum(total1) AS total1 sum(total2) AS total2 BY date_hour sourcetype
| eval grand_total = total1 + total2 
| chart values(grand_total) OVER date_hour BY sourcetype
| transpose header_field=date_hour
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Dec 2018 17:56:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-answer-a-question-with-the-chart-command/m-p/443261#M125775</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-12-21T17:56:51Z</dc:date>
    </item>
  </channel>
</rss>

