<?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 a new field with cumulative count of a unique ID in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Create-a-new-field-with-cumulative-count-of-a-unique-ID/m-p/215469#M63162</link>
    <description>&lt;P&gt;Use  &lt;CODE&gt;streamstats&lt;/CODE&gt; command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your_search&amp;gt; | streamstats count AS tripNo by vehID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps&lt;/P&gt;</description>
    <pubDate>Fri, 30 Oct 2015 12:59:29 GMT</pubDate>
    <dc:creator>aholzer</dc:creator>
    <dc:date>2015-10-30T12:59:29Z</dc:date>
    <item>
      <title>Create a new field with cumulative count of a unique ID</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-a-new-field-with-cumulative-count-of-a-unique-ID/m-p/215468#M63161</link>
      <description>&lt;P&gt;IS there a way I can create a new field with a cumulative count of a unique ID?&lt;/P&gt;

&lt;P&gt;For example, currently i have created a transaction which groups events together as "trips", however I would like to give each trip a number.&lt;/P&gt;

&lt;P&gt;below is an example of what I am trying to acheive:&lt;BR /&gt;
initially after using the transaction, the events will look like below. Each transaction event will have a unique vehicle ID, duration of trip and distance travelled.&lt;/P&gt;

&lt;P&gt;vehID,Duration,Distance&lt;BR /&gt;
1,30,40&lt;BR /&gt;
1,20,30&lt;BR /&gt;
2,30,40&lt;BR /&gt;
3,20,30&lt;BR /&gt;
3,40,50&lt;BR /&gt;
3,50,60&lt;/P&gt;

&lt;P&gt;I would like to add a cumulative count to act as a Trip Number.&lt;BR /&gt;
vehID,Duration,Distance,tripNo&lt;BR /&gt;
1,30,40,1&lt;BR /&gt;
1,20,30,2&lt;BR /&gt;
2,30,40,1&lt;BR /&gt;
3,20,30,1&lt;BR /&gt;
3,40,50,2&lt;BR /&gt;
3,50,60,3&lt;/P&gt;

&lt;P&gt;Could anyone advise how I could achieve the above?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2015 06:08:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-a-new-field-with-cumulative-count-of-a-unique-ID/m-p/215468#M63161</guid>
      <dc:creator>keithyap</dc:creator>
      <dc:date>2015-10-30T06:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new field with cumulative count of a unique ID</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-a-new-field-with-cumulative-count-of-a-unique-ID/m-p/215469#M63162</link>
      <description>&lt;P&gt;Use  &lt;CODE&gt;streamstats&lt;/CODE&gt; command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your_search&amp;gt; | streamstats count AS tripNo by vehID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2015 12:59:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-a-new-field-with-cumulative-count-of-a-unique-ID/m-p/215469#M63162</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2015-10-30T12:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new field with cumulative count of a unique ID</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-a-new-field-with-cumulative-count-of-a-unique-ID/m-p/215470#M63163</link>
      <description>&lt;P&gt;Thanks! that helped.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 01:48:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-a-new-field-with-cumulative-count-of-a-unique-ID/m-p/215470#M63163</guid>
      <dc:creator>keithyap</dc:creator>
      <dc:date>2015-11-02T01:48:20Z</dc:date>
    </item>
  </channel>
</rss>

