<?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 How to add another column from the same index with stats function? in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633025#M15562</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;How to add&amp;nbsp; another column from the same index with stats function?&lt;/P&gt;&lt;P&gt;| makeresults count=1 | addinfo | eval days=mvrange(info_min_time, info_max_time, "1d") | mvexpand days | eval _time=days&lt;BR /&gt;| join type=outer _time [ search index="*appevent" Type="*splunk" | bucket _time span=day | stats count by _time]&lt;BR /&gt;| rename count as "Total"&lt;BR /&gt;| eval "New_Date"=strftime(_time,"%Y-%m-%d")&lt;BR /&gt;| table "New_Date" "Total"| fillnull value=0 "Total"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used join because I need 30 days data even with 0. Please suggest.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Mar 2023 15:27:10 GMT</pubDate>
    <dc:creator>Neel881</dc:creator>
    <dc:date>2023-03-02T15:27:10Z</dc:date>
    <item>
      <title>How to add another column from the same index with stats function?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633025#M15562</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;How to add&amp;nbsp; another column from the same index with stats function?&lt;/P&gt;&lt;P&gt;| makeresults count=1 | addinfo | eval days=mvrange(info_min_time, info_max_time, "1d") | mvexpand days | eval _time=days&lt;BR /&gt;| join type=outer _time [ search index="*appevent" Type="*splunk" | bucket _time span=day | stats count by _time]&lt;BR /&gt;| rename count as "Total"&lt;BR /&gt;| eval "New_Date"=strftime(_time,"%Y-%m-%d")&lt;BR /&gt;| table "New_Date" "Total"| fillnull value=0 "Total"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used join because I need 30 days data even with 0. Please suggest.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 15:27:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633025#M15562</guid>
      <dc:creator>Neel881</dc:creator>
      <dc:date>2023-03-02T15:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to add another column from the same index with stats function?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633031#M15564</link>
      <description>&lt;P&gt;Have you tried this: (timechart uses earliest and latest (info_min_time and info_max_time respectively) and should fill in the missing days automatically)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="*appevent" Type="*splunk" 
| timechart span=1d count as "Total"
| eval "New_Date"=strftime(_time,"%Y-%m-%d")
| table "New_Date" "Total"&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 02 Mar 2023 15:59:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633031#M15564</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-03-02T15:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to add another column from the same index with stats function?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633033#M15565</link>
      <description>&lt;P&gt;You can use append instead of join.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=1 
| addinfo 
| eval days=mvrange(info_min_time, info_max_time, "1d") 
| mvexpand days 
| eval _time=days, count=0
| append [ search index="*appevent" Type="*splunk" 
  | bucket _time span=day
  | stats count by _time ]
| stats max(count) as Total by _time
| eval "New_Date"=strftime(_time,"%Y-%m-%d")
| table "New_Date" "Total"&lt;/LI-CODE&gt;&lt;P&gt;Or you can let timechart fill in the zeros.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="*appevent" Type="*splunk" 
| timechart span=1d count as Total by _time
| eval "New_Date"=strftime(_time,"%Y-%m-%d")
| table "New_Date" "Total"&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 02 Mar 2023 16:07:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633033#M15565</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-03-02T16:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to add another column from the same index with stats function?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633149#M15570</link>
      <description>&lt;P&gt;Thank you for your response.&lt;/P&gt;&lt;P&gt;I need to add another column from the same index ('index="*appevent" Type="*splunk" ). Column name is 'Type'. My question is how to add column 'Type' with the existing query?&lt;/P&gt;&lt;P&gt;Expecting output-&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Neel881_0-1677845873580.png" style="width: 990px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24176i11F5AE83EA324074/image-dimensions/990x120?v=v2" width="990" height="120" role="button" title="Neel881_0-1677845873580.png" alt="Neel881_0-1677845873580.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=1 
| addinfo 
| eval days=mvrange(info_min_time, info_max_time, "1d") 
| mvexpand days 
| eval _time=days, count=0
| append [ search index="*appevent" Type="*splunk" 
  | bucket _time span=day
  | stats count by _time ]
| stats max(count) as Total by _time
| eval "New_Date"=strftime(_time,"%Y-%m-%d")
| table "New_Date" "Total"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 12:20:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633149#M15570</guid>
      <dc:creator>Neel881</dc:creator>
      <dc:date>2023-03-03T12:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to add another column from the same index with stats function?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633152#M15571</link>
      <description>&lt;P&gt;Thank you for your response.&lt;/P&gt;&lt;P&gt;I getting I need to add another column from the same index ('index="*appevent" Type="*splunk" ). Column name is 'Type'. My question is how to add column 'Type' with the existing query?&lt;/P&gt;&lt;P&gt;Expecting output-&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Neel881_0-1677847493745.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24177i4B9282F22A5B8F27/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Neel881_0-1677847493745.png" alt="Neel881_0-1677847493745.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 12:45:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633152#M15571</guid>
      <dc:creator>Neel881</dc:creator>
      <dc:date>2023-03-03T12:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to add another column from the same index with stats function?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633154#M15572</link>
      <description>&lt;LI-CODE lang="markup"&gt;index="*appevent" Type="*splunk" 
| timechart span=1d count as "Total" by Type
| eval "New_Date"=strftime(_time,"%Y-%m-%d")
| untable New_Date Type Total&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 03 Mar 2023 13:03:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633154#M15572</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-03-03T13:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to add another column from the same index with stats function?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633164#M15574</link>
      <description>&lt;P&gt;The stats command is a transforming command so it discards any fields it doesn't produce or group by.&amp;nbsp; Add new fields to stats to get them in the output.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=1 
| addinfo 
| eval days=mvrange(info_min_time, info_max_time, "1d") 
| mvexpand days 
| eval _time=days, count=0
| append [ search index="*appevent" Type="*splunk" 
  | bucket _time span=day
  | stats count by _time, Type ]
| stats max(count) as Total by _time, Type
| eval "New_Date"=strftime(_time,"%Y-%m-%d")
| table "New_Date" "Total" Type&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 03 Mar 2023 13:28:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633164#M15574</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-03-03T13:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to add another column from the same index with stats function?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633165#M15575</link>
      <description>&lt;P&gt;Its working thank you so much!&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 13:33:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633165#M15575</guid>
      <dc:creator>Neel881</dc:creator>
      <dc:date>2023-03-03T13:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to add another column from the same index with stats function?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633721#M15632</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to add/join another column from the same search? Phase is the another column in the same index.&lt;/P&gt;&lt;PRE&gt;index="*appevent" Type="*splunk" 
| timechart span=1d count as "Total" by Type
| eval "New_Date"=strftime(_time,"%Y-%m-%d")
| untable New_Date Type Total&lt;/PRE&gt;&lt;P&gt;Pls suggest&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 13:15:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-add-another-column-from-the-same-index-with-stats/m-p/633721#M15632</guid>
      <dc:creator>Neel881</dc:creator>
      <dc:date>2023-03-08T13:15:14Z</dc:date>
    </item>
  </channel>
</rss>

