<?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: Count occurences of a field value depending on another field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Count-occurences-of-a-field-value-depending-on-another-field/m-p/395844#M114927</link>
    <description>&lt;P&gt;That's exactly what I was looking for ; Thank you very much&lt;/P&gt;</description>
    <pubDate>Sat, 01 Jun 2019 09:49:56 GMT</pubDate>
    <dc:creator>airmouli</dc:creator>
    <dc:date>2019-06-01T09:49:56Z</dc:date>
    <item>
      <title>Count occurences of a field value depending on another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-occurences-of-a-field-value-depending-on-another-field/m-p/395841#M114924</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have a set of data similar to this :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;session1 | user1 | computer 1 | start
session2 | user2 | computer 2 | start
session1 | user1 | computer 1 | stop
session2 | user2 | computer 2 | stop
session1 | user1 | computer 1 | start
session3 | user3 | computer 3 | start
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to count the number of starts and stops for each session.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;session1 | user1 | computer 1 |    2     |       1
session2 | user2 | computer 2 |    1     |       1
session3 | user3 | computer 3 |    1     |       0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thank you for your help&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 12:44:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-occurences-of-a-field-value-depending-on-another-field/m-p/395841#M114924</guid>
      <dc:creator>airmouli</dc:creator>
      <dc:date>2019-05-31T12:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Count occurences of a field value depending on another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-occurences-of-a-field-value-depending-on-another-field/m-p/395842#M114925</link>
      <description>&lt;P&gt;Try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[YOUR BASE SEARCH HERE] 
| stats count(eval(action="start")) as starts count(eval(action="stop")) as stops by session user computer
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I created a field called action for start and stop values, as well as giving the other fields logical names: session; user; and computer.&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 19:14:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-occurences-of-a-field-value-depending-on-another-field/m-p/395842#M114925</guid>
      <dc:creator>kmorris_splunk</dc:creator>
      <dc:date>2019-05-31T19:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: Count occurences of a field value depending on another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-occurences-of-a-field-value-depending-on-another-field/m-p/395843#M114926</link>
      <description>&lt;P&gt;I just realized my search was a bit off based on your request.  You wanted to know the number of starts and stops per session.  That would look more like the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[YOUR BASE SEARCH HERE] 
 | stats count(eval(action="start")) as starts count(eval(action="stop")) as stops values(user) as users values(computer) as computers by session
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The users and computers fields would have a multivalued list of all distinct values for the user and computer fields.  Not sure if that is what you wanted, but probably a good idea since there would be multiple values based on your data sample.&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 21:13:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-occurences-of-a-field-value-depending-on-another-field/m-p/395843#M114926</guid>
      <dc:creator>kmorris_splunk</dc:creator>
      <dc:date>2019-05-31T21:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: Count occurences of a field value depending on another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-occurences-of-a-field-value-depending-on-another-field/m-p/395844#M114927</link>
      <description>&lt;P&gt;That's exactly what I was looking for ; Thank you very much&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jun 2019 09:49:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-occurences-of-a-field-value-depending-on-another-field/m-p/395844#M114927</guid>
      <dc:creator>airmouli</dc:creator>
      <dc:date>2019-06-01T09:49:56Z</dc:date>
    </item>
  </channel>
</rss>

