<?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 get average count of one field  by day as a line chart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-average-count-of-one-field-by-day-as-a-line-chart/m-p/542059#M153535</link>
    <description>&lt;P&gt;Those commands (and those that follow) should work on your antique version of Splunk, but you really should upgrade soon.&lt;/P&gt;&lt;P&gt;"Nothing is working" is not helpful as a problem statement.&amp;nbsp; Describe the output and how it fails to meet expectations.&lt;/P&gt;&lt;P&gt;The fix could be something simple like adding "&lt;FONT face="courier new,courier"&gt;by userId&lt;/FONT&gt;" to the &lt;FONT face="courier new,courier"&gt;timechart&lt;/FONT&gt; command (which worked for me), or something more complex.&amp;nbsp; It depends on what results you want.&lt;/P&gt;</description>
    <pubDate>Wed, 03 Mar 2021 01:22:21 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2021-03-03T01:22:21Z</dc:date>
    <item>
      <title>How to get average count of one field  by day as a line chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-average-count-of-one-field-by-day-as-a-line-chart/m-p/542053#M153534</link>
      <description>&lt;P&gt;I have events that contain a userId field and I would like to make a line chart to visualize the average count per day of that field. How can I do this?&lt;/P&gt;&lt;P&gt;So far I have tried the following and a couple other arrangements but nothing is working.&lt;/P&gt;&lt;P&gt;index=foo | stats count by userId, _time | timechart avg(count)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(I am using Splunk enterprise 6.5.1. btw)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 23:15:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-average-count-of-one-field-by-day-as-a-line-chart/m-p/542053#M153534</guid>
      <dc:creator>vmvd</dc:creator>
      <dc:date>2021-03-02T23:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to get average count of one field  by day as a line chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-average-count-of-one-field-by-day-as-a-line-chart/m-p/542059#M153535</link>
      <description>&lt;P&gt;Those commands (and those that follow) should work on your antique version of Splunk, but you really should upgrade soon.&lt;/P&gt;&lt;P&gt;"Nothing is working" is not helpful as a problem statement.&amp;nbsp; Describe the output and how it fails to meet expectations.&lt;/P&gt;&lt;P&gt;The fix could be something simple like adding "&lt;FONT face="courier new,courier"&gt;by userId&lt;/FONT&gt;" to the &lt;FONT face="courier new,courier"&gt;timechart&lt;/FONT&gt; command (which worked for me), or something more complex.&amp;nbsp; It depends on what results you want.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 01:22:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-average-count-of-one-field-by-day-as-a-line-chart/m-p/542059#M153535</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-03-03T01:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to get average count of one field  by day as a line chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-average-count-of-one-field-by-day-as-a-line-chart/m-p/542221#M153587</link>
      <description>&lt;P&gt;When I plug this query into splunk and go to visualization and select line chart, I get a flat line. Under the visualization it shows _time as a column and avg(count) as a column. Under _time it lists days. Under avg(count) it lists1.0000 for every day.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The visualization shows a flat line, but should be varying because the avg(count) of the&amp;nbsp;&lt;SPAN&gt;userId should not be 1.0000 every day. It varies but tends to be around 6.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Adding "by userId" to the end of the query creates a column for every userId, and there are thousands. I do not want a line for every userId. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have tried taking _time out so that by query is "index=foo | stats count by userId | timechart avg(count)" but then I get "No results found". There are events that should be found however.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 17:35:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-average-count-of-one-field-by-day-as-a-line-chart/m-p/542221#M153587</guid>
      <dc:creator>vmvd</dc:creator>
      <dc:date>2021-03-03T17:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to get average count of one field  by day as a line chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-average-count-of-one-field-by-day-as-a-line-chart/m-p/542234#M153591</link>
      <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;timechart&lt;/FONT&gt; command requires the _time field so &lt;FONT face="courier new,courier"&gt;stats&lt;/FONT&gt; must always be by that field.&lt;/P&gt;&lt;P&gt;I suspect what is happening is each userId event has a unique timestamp so the &lt;FONT face="courier new,courier"&gt;stats&lt;/FONT&gt; command is producing a count field of only 1.&amp;nbsp; The fix for that is the &lt;FONT face="courier new,courier"&gt;bin&lt;/FONT&gt; command.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=foo 
| bin span=1d _time
| stats count by userId, _time 
| timechart span=1d avg(count) as AvgCount&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 18:40:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-average-count-of-one-field-by-day-as-a-line-chart/m-p/542234#M153591</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-03-03T18:40:36Z</dc:date>
    </item>
  </channel>
</rss>

