<?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: Create 1-up number (1-to-n) field for each event and create field that combines the 1-up number and total count in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Create-1-up-number-1-to-n-field-for-each-event-and-create-field/m-p/443345#M125789</link>
    <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| eventstats count AS Total 
| streamstats count as sno 
| eval EventNumber = sno." of ".Total
| Table Cluster, OwnerNode, RoleName, Total  EventNumber 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 18 Mar 2019 15:09:40 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2019-03-18T15:09:40Z</dc:date>
    <item>
      <title>Create 1-up number (1-to-n) field for each event and create field that combines the 1-up number and total count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-1-up-number-1-to-n-field-for-each-event-and-create-field/m-p/443344#M125788</link>
      <description>&lt;P&gt;I have a search that returns a event count total and produces a table&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;... | eventstats count AS Total | Table foo, bar, Total&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Search result is, e.g., &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;foo | bar | Total&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;fx1 |  bx1 |  3&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;fx2 |  bx2 |  3&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;fx3 |  bx3 |  3&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;My goal is to produce a 4th column named "EventNumber" that shows "&lt;STRONG&gt;E&lt;/STRONG&gt; of &lt;STRONG&gt;N&lt;/STRONG&gt;" when &lt;STRONG&gt;E&lt;/STRONG&gt; is the ordinal position of the event in the search results and &lt;STRONG&gt;N&lt;/STRONG&gt; is the total number of events in the search rsults&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;foo | bar | Total | EventNumber&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;fx1 | bx1 | 3     | 1 of 3&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;fx2 | bx2 | 3     | 2 of 3&lt;/CODE&gt; &lt;BR /&gt;
&lt;CODE&gt;fx3 | bx3 | 3     | 3 of 3&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;So, something like&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;... eventstats count AS Total | Table Cluster, OwnerNode, RoleName, Total | eval EventNumber = ?????." of ".Total&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;How do I create a 1-up number (1-to-n) field for each event and create a field that combines the 1-up number and total count of events?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2019 13:48:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-1-up-number-1-to-n-field-for-each-event-and-create-field/m-p/443344#M125788</guid>
      <dc:creator>williamcharlton</dc:creator>
      <dc:date>2019-03-18T13:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create 1-up number (1-to-n) field for each event and create field that combines the 1-up number and total count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-1-up-number-1-to-n-field-for-each-event-and-create-field/m-p/443345#M125789</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| eventstats count AS Total 
| streamstats count as sno 
| eval EventNumber = sno." of ".Total
| Table Cluster, OwnerNode, RoleName, Total  EventNumber 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Mar 2019 15:09:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-1-up-number-1-to-n-field-for-each-event-and-create-field/m-p/443345#M125789</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-03-18T15:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create 1-up number (1-to-n) field for each event and create field that combines the 1-up number and total count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-1-up-number-1-to-n-field-for-each-event-and-create-field/m-p/443346#M125790</link>
      <description>&lt;P&gt;I see - &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.4/SearchReference/Streamstats"&gt;&lt;CODE&gt;The streamstats command calculates statistics for each event at the time the event is seen&lt;/CODE&gt;&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Good to know. Thank -you&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2019 15:20:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-1-up-number-1-to-n-field-for-each-event-and-create-field/m-p/443346#M125790</guid>
      <dc:creator>williamcharlton</dc:creator>
      <dc:date>2019-03-18T15:20:21Z</dc:date>
    </item>
  </channel>
</rss>

