<?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: Make a stats by value a separate field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Make-a-stats-by-value-a-separate-field/m-p/553681#M157209</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228215"&gt;@ebs&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;in the stats command you can assign the field name as you want, e.g. something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats avg(a) AS a avg(b) AS b BY c&lt;/LI-CODE&gt;&lt;P&gt;and anyway, you have the rename command to change a field name.&lt;/P&gt;&lt;P&gt;about the null values, you have to try to use the fillnull command.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Mon, 31 May 2021 06:19:55 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2021-05-31T06:19:55Z</dc:date>
    <item>
      <title>Make a stats by value a separate field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Make-a-stats-by-value-a-separate-field/m-p/553218#M157049</link>
      <description>&lt;P&gt;I've performed a stats by command I was wondering if there was a way to store all these as fields and then for the by field which has returned 0 make it null.&lt;/P&gt;&lt;P&gt;For context I performed an eval field to create a new field on via case then performed a stats by command.&lt;/P&gt;&lt;P&gt;stats command:&amp;nbsp;stats avg(response_time) by category&lt;/P&gt;</description>
      <pubDate>Thu, 27 May 2021 01:59:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Make-a-stats-by-value-a-separate-field/m-p/553218#M157049</guid>
      <dc:creator>ebs</dc:creator>
      <dc:date>2021-05-27T01:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: Make a stats by value a separate field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Make-a-stats-by-value-a-separate-field/m-p/553230#M157053</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228215"&gt;@ebs&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I'm not sure to understood your questions:&lt;/P&gt;&lt;P&gt;you want to know how to pass all fields after a stats command and how to manage values where the BY fields are null, is it correct?&lt;/P&gt;&lt;P&gt;If this is your need:&lt;/P&gt;&lt;P&gt;it's better to have in the stats command only the fields you need so you use less memory, but if you want to have all the fields, you could use &lt;STRONG&gt;values(*) AS *&lt;/STRONG&gt;&amp;nbsp;, but I don't like.&lt;/P&gt;&lt;P&gt;Abouth the null BY fields, you can use the &lt;STRONG&gt;fillnull&lt;/STRONG&gt; command (adding e.g. "-") before the stats command, in this way you're sure that all the events have a value for the BY fields.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 27 May 2021 05:47:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Make-a-stats-by-value-a-separate-field/m-p/553230#M157053</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-05-27T05:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: Make a stats by value a separate field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Make-a-stats-by-value-a-separate-field/m-p/553673#M157207</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;To explain further when I do my &lt;EM&gt;stats avg by&lt;/EM&gt; command I have one column of field values and one column of correlating stats values. What I want to do is take the stats value and then assign it a field with the name of the corresponding field value e.g. if the avg of a = 3 and the avg of b = 5 I then want a field created called a, where the field value is 3 and another field called b where the value is 5. If there is then a value of c where there are no results, I want that created into a field and then do a fillnull command.&lt;/P&gt;&lt;P&gt;Also I specifically wanted the fillnull value for the created stats field&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 31 May 2021 01:43:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Make-a-stats-by-value-a-separate-field/m-p/553673#M157207</guid>
      <dc:creator>ebs</dc:creator>
      <dc:date>2021-05-31T01:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Make a stats by value a separate field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Make-a-stats-by-value-a-separate-field/m-p/553681#M157209</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228215"&gt;@ebs&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;in the stats command you can assign the field name as you want, e.g. something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats avg(a) AS a avg(b) AS b BY c&lt;/LI-CODE&gt;&lt;P&gt;and anyway, you have the rename command to change a field name.&lt;/P&gt;&lt;P&gt;about the null values, you have to try to use the fillnull command.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 31 May 2021 06:19:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Make-a-stats-by-value-a-separate-field/m-p/553681#M157209</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-05-31T06:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Make a stats by value a separate field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Make-a-stats-by-value-a-separate-field/m-p/553690#M157211</link>
      <description>&lt;P&gt;Have you considered transpose?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| transpose 0 header_field=value&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 31 May 2021 07:37:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Make-a-stats-by-value-a-separate-field/m-p/553690#M157211</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-05-31T07:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: Make a stats by value a separate field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Make-a-stats-by-value-a-separate-field/m-p/553737#M157221</link>
      <description>&lt;P&gt;Thanks so much! I didn't even think of this command&lt;/P&gt;</description>
      <pubDate>Mon, 31 May 2021 23:21:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Make-a-stats-by-value-a-separate-field/m-p/553737#M157221</guid>
      <dc:creator>ebs</dc:creator>
      <dc:date>2021-05-31T23:21:33Z</dc:date>
    </item>
  </channel>
</rss>

