<?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: customerID percentage on a particular channelID based on specific event value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342958#M101560</link>
    <description>&lt;P&gt;when i run this, i'm getting 7 total_customer_searches and 1 anonymous_customer_searches with 14%. That is accurate. if you break the syntax apart, pull in a small time range with a small set of data and run each line at a time, perhaps, make sure the data matches the output. If the counts aren't matching, let me know.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval customerId="123456,6546788,765478,-1,1257862,4867354,5884368"|makemv customerId delim=","|mvexpand customerId|timechart  count(customerId) as total_customer_searches, count(eval(customerId="-1")) as anonymous_customer_Searches | eval anonymous_search_percent=((anonymous_customer_Searches/total_customer_searches)*100)|fillnull anonymous_search_percent value=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 29 Sep 2020 15:07:31 GMT</pubDate>
    <dc:creator>cmerriman</dc:creator>
    <dc:date>2020-09-29T15:07:31Z</dc:date>
    <item>
      <title>customerID percentage on a particular channelID based on specific event value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342952#M101554</link>
      <description>&lt;P&gt;I am running this query but not getting desired output.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myapp sourcetype=log_source host="*myhost*" "Event*" AND "sell event" channelId=xyz
| timechart count(customerId) as total_customer_searches, count(eval(customerID=-1)) as anonymous_customer_Searches
| eval anonymous_search_percent=((anonymous_customer_Searches/total_customer_searches)*100)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;so, &lt;CODE&gt;customerID&lt;/CODE&gt; could have &lt;CODE&gt;-1&lt;/CODE&gt; OR any positive integer value. there are multiple &lt;CODE&gt;channelId&lt;/CODE&gt; ( &lt;CODE&gt;abc&lt;/CODE&gt;, &lt;CODE&gt;def&lt;/CODE&gt;, &lt;CODE&gt;ghi&lt;/CODE&gt;... &lt;CODE&gt;xyz&lt;/CODE&gt; ) and I need to get a timechart or stats count of the percentage for &lt;CODE&gt;customerId&lt;/CODE&gt;=&lt;CODE&gt;-1&lt;/CODE&gt; on &lt;CODE&gt;channelId&lt;/CODE&gt;=&lt;CODE&gt;xyz&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 04:56:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342952#M101554</guid>
      <dc:creator>iqbalintouch</dc:creator>
      <dc:date>2017-07-31T04:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: customerID percentage on a particular channelID based on specific event value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342953#M101555</link>
      <description>&lt;P&gt;@iqbalintouch, &lt;STRONG&gt;field names are case sensitive&lt;/STRONG&gt;. So, in case your field name is customerID, the  &lt;CODE&gt;count(customerId)&lt;/CODE&gt; should actually be &lt;CODE&gt;count(customerID)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Also try out &lt;CODE&gt;round()&lt;/CODE&gt; function for percentage to reduce to two digit precision or whatever you like.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval anonymous_search_percent=round(((anonymous_customer_Searches/total_customer_searches)*100),2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try out and confirm.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 11:14:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342953#M101555</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-07-31T11:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: customerID percentage on a particular channelID based on specific event value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342954#M101556</link>
      <description>&lt;P&gt;try something along these lines:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myapp sourcetype=log_source host="*myhost*" channelId=xyz ("Event*" AND "sell event" )
 | timechart count(customerID) as total_customer_searches, count(eval(customerID="-1")) as anonymous_customer_Searches
 | eval anonymous_search_percent=((anonymous_customer_Searches/total_customer_searches)*100)
|fillnull anonymous_search_percent value=0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;using customerID instead of customerId and placing -1 inside quotations. I also added a fillnull incase some of the anonymous_search_percents were not filled out.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:07:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342954#M101556</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2020-09-29T15:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: customerID percentage on a particular channelID based on specific event value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342955#M101557</link>
      <description>&lt;P&gt;@cmerriman, I dont think double quotes for &lt;CODE&gt;-1&lt;/CODE&gt; is required. I expect the solution to be only casing issue with Field Name casing.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2017 02:10:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342955#M101557</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-08-01T02:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: customerID percentage on a particular channelID based on specific event value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342956#M101558</link>
      <description>&lt;P&gt;Hi @niketnilay, &lt;/P&gt;

&lt;P&gt;I wrongly mentioned as customerID, correct value is customerId. I have corrected it and ran the query still not getting desired output.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2017 04:57:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342956#M101558</guid>
      <dc:creator>iqbalintouch</dc:creator>
      <dc:date>2017-08-01T04:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: customerID percentage on a particular channelID based on specific event value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342957#M101559</link>
      <description>&lt;P&gt;Hi @cmerriman,&lt;/P&gt;

&lt;P&gt;Query is looking good but not getting desired output. Anonymous search percent is showing more than 80% which shouldn't be..most of the time it should be &amp;gt;=5%.&lt;/P&gt;

&lt;P&gt;customerId can have any values like 123456, 6546788, -1, 765478 out of these customerId's only those searches with customerId=-1 are anonymous search. Hope this help !&lt;/P&gt;

&lt;P&gt;Please let me know if you need more details.&lt;BR /&gt;
Thank yoU!&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2017 05:05:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342957#M101559</guid>
      <dc:creator>iqbalintouch</dc:creator>
      <dc:date>2017-08-01T05:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: customerID percentage on a particular channelID based on specific event value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342958#M101560</link>
      <description>&lt;P&gt;when i run this, i'm getting 7 total_customer_searches and 1 anonymous_customer_searches with 14%. That is accurate. if you break the syntax apart, pull in a small time range with a small set of data and run each line at a time, perhaps, make sure the data matches the output. If the counts aren't matching, let me know.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval customerId="123456,6546788,765478,-1,1257862,4867354,5884368"|makemv customerId delim=","|mvexpand customerId|timechart  count(customerId) as total_customer_searches, count(eval(customerId="-1")) as anonymous_customer_Searches | eval anonymous_search_percent=((anonymous_customer_Searches/total_customer_searches)*100)|fillnull anonymous_search_percent value=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:07:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342958#M101560</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2020-09-29T15:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: customerID percentage on a particular channelID based on specific event value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342959#M101561</link>
      <description>&lt;P&gt;Hi @cmerriman,&lt;/P&gt;

&lt;P&gt;Yes, if I take the above example it is working fine but when I add index, sourcetype, host and channelId the query is not working.&lt;BR /&gt;
so in your query you need the string:  index=myapp sourcetype=log_source host="&lt;EM&gt;myhost&lt;/EM&gt;" "Event*" AND "sell event" channelId=xyz&lt;/P&gt;

&lt;P&gt;so we just need to make it certain that anonymous customer percentage shouldn't be increasing on channelId=xyz.&lt;BR /&gt;
NOTE: customerId can have -1 value or any positive numeric value...and these numbers can be in thousands and millions so we need to make a percent comparison of known and unknown customers.&lt;BR /&gt;
In other words known(non -1) CUSTOMER_ID % should be at least 95%.&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 03:05:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342959#M101561</guid>
      <dc:creator>iqbalintouch</dc:creator>
      <dc:date>2017-08-02T03:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: customerID percentage on a particular channelID based on specific event value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342960#M101562</link>
      <description>&lt;P&gt;try running this and see if you get the expected outcome where customerId of -1 has a value of 1 in IsOfConcern and all other customerIds have a value of 0:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myapp sourcetype=log_source host="*myhost*" channelId=xyz (Event* AND "sell event" ) | eval IsOfConcern = if(customerId="-1", 1, 0) | table customerId, IsOfConcern
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;if you're seeing the correct values and the number of rows you might expect in total, then everything should be accurate. Otherwise we might have a problem with the base search/source data.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 13:31:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342960#M101562</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-08-02T13:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: customerID percentage on a particular channelID based on specific event value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342961#M101563</link>
      <description>&lt;P&gt;Seems to be correct @cmerriman . Now I need the percentage value of both customerId's.&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 09:02:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342961#M101563</guid>
      <dc:creator>iqbalintouch</dc:creator>
      <dc:date>2017-08-03T09:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: customerID percentage on a particular channelID based on specific event value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342962#M101564</link>
      <description>&lt;P&gt;you can use the IsOfConcern and sum those up, if you'd like. &lt;BR /&gt;
something like (if it doesn't appear correct, start doing it line by line until you see where it looks wrong):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=myapp sourcetype=log_source host="*myhost*" channelId=xyz (Event* AND "sell event" ) | eval IsOfConcern = if(customerId="-1", 1, 0)| table customerId, IsOfConcern|stats sum(IsOfConcern) as anonymous_customer_Searches count as total_customer_searches| eval anonymous_search_percent=((anonymous_customer_Searches/total_customer_searches)*100)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;if you need it by _time, you can sub stats for timechart, or add &lt;CODE&gt;|bucket _time span=1h|stats ...... by _time&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 11:48:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/customerID-percentage-on-a-particular-channelID-based-on/m-p/342962#M101564</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-08-03T11:48:26Z</dc:date>
    </item>
  </channel>
</rss>

