<?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: how to restrict where condition.? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113523#M29877</link>
    <description>&lt;P&gt;@vganjare , it is showing rural and urban but of same values.&lt;BR /&gt;
Rural=19.304&lt;BR /&gt;
Urban=19.304.&lt;/P&gt;</description>
    <pubDate>Tue, 19 May 2015 06:46:11 GMT</pubDate>
    <dc:creator>SanthoshSreshta</dc:creator>
    <dc:date>2015-05-19T06:46:11Z</dc:date>
    <item>
      <title>how to restrict where condition.?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113520#M29874</link>
      <description>&lt;P&gt;Hi All.&lt;/P&gt;

&lt;P&gt;I have a scenario where, the where clause is used to filter and other side the same where clause should not effect the final stats command.&lt;BR /&gt;
query is &lt;BR /&gt;
&lt;STRONG&gt;sourcetype="Customer_Churn" &lt;BR /&gt;
| eventstats count(CHURN) by PLACEMENT&lt;BR /&gt;
| where CHURN="0" &lt;BR /&gt;
| eventstats count(CHURN) as c0p&lt;BR /&gt;
| eventstats count(CHURN)&lt;BR /&gt;
| where CHURN="0" AND PLACEMENT=0&lt;BR /&gt;
| eventstats count(CHURN) as c0p0&lt;BR /&gt;
| eval p=c0p0/c0p*100&lt;BR /&gt;
| stats values(p) by PLACEMENT&lt;BR /&gt;
| replace 0 with Rural in PLACEMENT &lt;BR /&gt;
| replace 1 with Urban in PLACEMENT&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;i need for rural and urban. for now am only getting rural values.&lt;BR /&gt;
please help me out. can anyone give me same logic using sub search. i am unaware of such things..&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Santhosh.&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 05:52:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113520#M29874</guid>
      <dc:creator>SanthoshSreshta</dc:creator>
      <dc:date>2015-05-19T05:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to restrict where condition.?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113521#M29875</link>
      <description>&lt;P&gt;You can try using conditional stats. Try following query:&lt;BR /&gt;
    sourcetype="Customer_Churn" &lt;BR /&gt;
    | eventstats count(CHURN) by PLACEMENT &lt;BR /&gt;
    | eventstats count(eval(CHURN=="0")) as c0p&lt;BR /&gt;
    | eventstats count(CHURN)&lt;BR /&gt;
    | eventstats count(eval(CHURN=="0" AND PLACEMENT==0)) as c0p0&lt;BR /&gt;
    | eval p=c0p0/c0p*100&lt;BR /&gt;
    | stats values(p) by PLACEMENT&lt;BR /&gt;
    | replace 0 with Rural in PLACEMENT &lt;BR /&gt;
    | replace 1 with Urban in PLACEMENT&lt;/P&gt;

&lt;P&gt;Basically, try to provide the condition within the event stats command like **    | eventstats count(eval(CHURN=="0")) as c0p**&lt;/P&gt;

&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 06:38:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113521#M29875</guid>
      <dc:creator>vganjare</dc:creator>
      <dc:date>2015-05-19T06:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to restrict where condition.?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113522#M29876</link>
      <description>&lt;P&gt;Eventstats is expensive, as it iterates through each event and writes the field back to the event. You might be able to consolidate this down to...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eventstats count(CHURN) count(eval(CHURN=="0")) as c0p count(eval(CHURN=="0" AND PLACEMENT==0)) as c0p0 by PLACEMENT 
| eval p=c0p0/c0p*100
| stats values(p) by PLACEMENT
| replace 0 with Rural in PLACEMENT 
| replace 1 with Urban in PLACEMENT
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Not sure if that will work without seeing your data set.&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 06:43:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113522#M29876</guid>
      <dc:creator>esix_splunk</dc:creator>
      <dc:date>2015-05-19T06:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to restrict where condition.?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113523#M29877</link>
      <description>&lt;P&gt;@vganjare , it is showing rural and urban but of same values.&lt;BR /&gt;
Rural=19.304&lt;BR /&gt;
Urban=19.304.&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 06:46:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113523#M29877</guid>
      <dc:creator>SanthoshSreshta</dc:creator>
      <dc:date>2015-05-19T06:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to restrict where condition.?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113524#M29878</link>
      <description>&lt;P&gt;Do you have additional values in PLACEMENT apart from 0 and 1? If only two values are present, you can use &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    | eval PLACEMENT = if(PLACEMENT =="0", "Rural", "Urban")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also, your problem statement is not clear.&lt;/P&gt;

&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 06:54:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113524#M29878</guid>
      <dc:creator>vganjare</dc:creator>
      <dc:date>2015-05-19T06:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to restrict where condition.?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113525#M29879</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/202391"&gt;@esix_splunk&lt;/a&gt; for the code you have sent it is showing Rural=100 and Urban=0.&lt;BR /&gt;
so i tried of separating like as&lt;BR /&gt;
&lt;STRONG&gt;sourcetype="Customer_Churn"&lt;BR /&gt;&lt;BR /&gt;
| eventstats count(eval(CHURN=="0")) as c0p &lt;BR /&gt;
| eventstats count(eval(CHURN=="0" AND PLACEMENT=="0")) as c0p0 by PLACEMENT&lt;BR /&gt;
| eval p=c0p0/c0p*100&lt;BR /&gt;
| stats values(p) by PLACEMENT&lt;BR /&gt;
| replace 0 with Rural in PLACEMENT &lt;BR /&gt;
| replace 1 with Urban in PLACEMENT&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;then it started showing Rural=19.304 and Urban=0. but i need Urban=80.906 &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Any ideas.?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:59:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113525#M29879</guid>
      <dc:creator>SanthoshSreshta</dc:creator>
      <dc:date>2020-09-28T19:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to restrict where condition.?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113526#M29880</link>
      <description>&lt;P&gt;Provide a sample of your data set if you can.&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 06:59:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113526#M29880</guid>
      <dc:creator>esix_splunk</dc:creator>
      <dc:date>2015-05-19T06:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to restrict where condition.?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113527#M29881</link>
      <description>&lt;P&gt;NO @vganjare I don't have other values except 0 and 1. I have used then it is showing Rural=19.304 and Urban=0.&lt;/P&gt;

&lt;P&gt;My problem is, I am not able to get the value for Urban.&lt;BR /&gt;
I want Rural=19.304 and Urban=80.06.&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 07:06:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113527#M29881</guid>
      <dc:creator>SanthoshSreshta</dc:creator>
      <dc:date>2015-05-19T07:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to restrict where condition.?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113528#M29882</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/202391"&gt;@esix_splunk&lt;/a&gt; , here it is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;PLACEMENT       CHURN     customer#
------------------------------------------------------------
     0                        1                 1
     1                        1                 2
     1                        0                 3
     1                        1                 4
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want the proportion ratio. &lt;BR /&gt;
ie:for &lt;BR /&gt;
Rural: prop_ratio=(count(Customer#) where CHURN=0 and PLACEMENT=0) / count(customer#) where CHURN=0 and PLACEMENT=0 and 1&lt;BR /&gt;
Urban: prop_ratio=(count(Customer#) where CHURN=0 and PLACEMENT=1) / count(customer#) where CHURN=0 and PLACEMENT=0 and 1&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:59:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113528#M29882</guid>
      <dc:creator>SanthoshSreshta</dc:creator>
      <dc:date>2020-09-28T19:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to restrict where condition.?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113529#M29883</link>
      <description>&lt;P&gt;Hi, vganjare by using this query I am able to get both values of rural and urban&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="Customer_Churn" 
|stats count(eval(CHURN==0)) AS totalChurn  count(eval(CHURN==0 AND PLACEMENT==0)) AS ruralChurn   count(eval(CHURN==0 AND PLACEMENT==1)) AS urbanChurn by sourcetype
|eval ruralChurnPercentage = (ruralChurn*100)/totalChurn  
|eval urbanChurnPercentage = (urbanChurn*100)/totalChurn
|table  ruralChurnPercentage urbanChurnPercentage
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but they are in table form. when converted to column they are not plotting. on y-axis percentage should come and two column values as urban and rural must come.&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 08:17:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113529#M29883</guid>
      <dc:creator>SanthoshSreshta</dc:creator>
      <dc:date>2015-05-19T08:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to restrict where condition.?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113530#M29884</link>
      <description>&lt;P&gt;can you try using the visualization options provided in splunk to check if any other visualization is coming or not?&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 08:23:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113530#M29884</guid>
      <dc:creator>vganjare</dc:creator>
      <dc:date>2015-05-19T08:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to restrict where condition.?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113531#M29885</link>
      <description>&lt;P&gt;No @vganjare .&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 08:30:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113531#M29885</guid>
      <dc:creator>SanthoshSreshta</dc:creator>
      <dc:date>2015-05-19T08:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to restrict where condition.?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113532#M29886</link>
      <description>&lt;P&gt;Can you please share the output?&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 08:36:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113532#M29886</guid>
      <dc:creator>vganjare</dc:creator>
      <dc:date>2015-05-19T08:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to restrict where condition.?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113533#M29887</link>
      <description>&lt;P&gt;ThanQ @vganjare finally you make me smile&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 10:40:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-restrict-where-condition/m-p/113533#M29887</guid>
      <dc:creator>SanthoshSreshta</dc:creator>
      <dc:date>2015-05-19T10:40:01Z</dc:date>
    </item>
  </channel>
</rss>

