<?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: help with if-else statement in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495670#M194597</link>
    <description>&lt;P&gt;hi, thanks for your answer but it is not what i asked for.. i don't need the percentage of the results.. &lt;BR /&gt;
i need the results as they were in the first query and need to check on the results if there are some raws that don't have same count&lt;/P&gt;</description>
    <pubDate>Sun, 10 May 2020 10:14:46 GMT</pubDate>
    <dc:creator>sarit_s</dc:creator>
    <dc:date>2020-05-10T10:14:46Z</dc:date>
    <item>
      <title>help with if-else statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495667#M194594</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have this query :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="prod" eventtype="csm-messages-dhcpd-lpf-eth0-sending" OR eventtype="csm-messages-dhcpd-lpf-eth0-listening" OR eventtype="csm-messages-dhcpd-send-socket-fallback-net" OR eventtype="csm-messages-dhcpd-write-zero-leases" OR eventtype="csm-messages-dhcpd-eth1-nosubnet-declared" 
| timechart span=1m count BY eventtype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which gives me results that looks like this :&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;_time csm-messages-dhcpd-eth1-nosubnet-declared   csm-messages-dhcpd-lpf-eth0-listening   csm-messages-dhcpd-lpf-eth0-sending csm-messages-dhcpd-send-socket-fallback-net csm-messages-dhcpd-write-zero-leases&lt;BR /&gt;
2019-08-05 10:24:00   1   1   1   1   1&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;I have few questions :&lt;BR /&gt;
1. is there a way to write the query in such way that will return more than 5000 results?&lt;BR /&gt;
2. how can i check this terms:&lt;BR /&gt;
If count is not equal for all rules:&lt;BR /&gt;
Find timestamps of instances that don’t match count&lt;BR /&gt;
For each unique timestamp from the previous step, alert “CSM DHCP Anomaly” as ”Medium”&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Sun, 10 May 2020 07:10:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495667#M194594</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2020-05-10T07:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: help with if-else statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495668#M194595</link>
      <description>&lt;PRE&gt;&lt;CODE&gt; index="prod" eventtype="csm-messages-dhcpd-lpf-eth0-sending" OR eventtype="csm-messages-dhcpd-lpf-eth0-listening" OR eventtype="csm-messages-dhcpd-send-socket-fallback-net" OR eventtype="csm-messages-dhcpd-write-zero-leases" OR eventtype="csm-messages-dhcpd-eth1-nosubnet-declared" 
| bin span=1min _time
| stats count by _time eventtype
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 May 2020 08:57:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495668#M194595</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-10T08:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: help with if-else statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495669#M194596</link>
      <description>&lt;P&gt;Hi @sarit_s,&lt;BR /&gt;
I'm not sure that you can satisfy all your needs, anyway:&lt;BR /&gt;
for the first request use stats instead timechart&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="prod" eventtype="csm-messages-dhcpd-lpf-eth0-sending" OR eventtype="csm-messages-dhcpd-lpf-eth0-listening" OR eventtype="csm-messages-dhcpd-send-socket-fallback-net" OR eventtype="csm-messages-dhcpd-write-zero-leases" OR eventtype="csm-messages-dhcpd-eth1-nosubnet-declared" 
| bin span=1m _time
| chart count OVER _time BY eventtype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But are you sure to want more than 5000 results? it's very difficoult to read these results!&lt;/P&gt;

&lt;P&gt;For the second question the command to use is rare at the end of the search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="prod" eventtype="csm-messages-dhcpd-lpf-eth0-sending" OR eventtype="csm-messages-dhcpd-lpf-eth0-listening" OR eventtype="csm-messages-dhcpd-send-socket-fallback-net" OR eventtype="csm-messages-dhcpd-write-zero-leases" OR eventtype="csm-messages-dhcpd-eth1-nosubnet-declared" 
| bin span=1m _time
| stats count BY _time eventtype
| rare _time eventtype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For the third question you alread have the value but grouped by span, if you want the exact vale, try something like this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="prod" eventtype="csm-messages-dhcpd-lpf-eth0-sending" OR eventtype="csm-messages-dhcpd-lpf-eth0-listening" OR eventtype="csm-messages-dhcpd-send-socket-fallback-net" OR eventtype="csm-messages-dhcpd-write-zero-leases" OR eventtype="csm-messages-dhcpd-eth1-nosubnet-declared" 
| stats count BY _time eventtype
| rare _time eventtype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Sun, 10 May 2020 09:20:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495669#M194596</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-05-10T09:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: help with if-else statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495670#M194597</link>
      <description>&lt;P&gt;hi, thanks for your answer but it is not what i asked for.. i don't need the percentage of the results.. &lt;BR /&gt;
i need the results as they were in the first query and need to check on the results if there are some raws that don't have same count&lt;/P&gt;</description>
      <pubDate>Sun, 10 May 2020 10:14:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495670#M194597</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2020-05-10T10:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: help with if-else statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495671#M194598</link>
      <description>&lt;P&gt;thanks for your answer but it is not giving the wanted results &lt;/P&gt;</description>
      <pubDate>Sun, 10 May 2020 10:26:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495671#M194598</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2020-05-10T10:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: help with if-else statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495672#M194599</link>
      <description>&lt;P&gt;really?&lt;/P&gt;

&lt;P&gt;this display over 5000 rows.&lt;/P&gt;

&lt;P&gt;I can't answer Q2 because there is not the detail.&lt;/P&gt;</description>
      <pubDate>Sun, 10 May 2020 20:41:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495672#M194599</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-10T20:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: help with if-else statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495673#M194600</link>
      <description>&lt;P&gt;Hey,&lt;BR /&gt;
maybe it display more than 50000 but not the right results &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
any way, the main thing is Q2.. &lt;BR /&gt;
i will try to explain it better.. &lt;BR /&gt;
i have 5 eventtypes.. each one of them has count value.. &lt;BR /&gt;
the good scenario is when the count value of all the eventtypes is equal.. so i want to check if this value is equal (for each raw) and if not to do what is written in my question.. &lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 06:39:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495673#M194600</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2020-05-11T06:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: help with if-else statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495674#M194601</link>
      <description>&lt;P&gt;Hi @sarit_s,&lt;BR /&gt;
try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal
| bin span=10m _time
| stats count AS my_count BY source _time showperc=false
| rare source,_time BY my_count
| sort my_count
| head 10
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that related to your example is&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="prod" eventtype="csm-messages-dhcpd-lpf-eth0-sending" OR eventtype="csm-messages-dhcpd-lpf-eth0-listening" OR eventtype="csm-messages-dhcpd-send-socket-fallback-net" OR eventtype="csm-messages-dhcpd-write-zero-leases" OR eventtype="csm-messages-dhcpd-eth1-nosubnet-declared" 
| bin span=1m _time
| stats count AS my_count BY _time eventtype
| rare _time eventtype By my_count showperc=false
| sort my_count
| head 10
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I setted a threeshold of the first 10, but you can choose a different one.&lt;BR /&gt;
If the most events have the same value, you could use perc to find the different values.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 06:57:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495674#M194601</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-05-11T06:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: help with if-else statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495675#M194602</link>
      <description>&lt;P&gt;thanks for your answer.. can you please explain how it is answering my question ?&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 08:20:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495675#M194602</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2020-05-11T08:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: help with if-else statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495676#M194603</link>
      <description>&lt;P&gt;Hi @sarit_s,&lt;BR /&gt;
Using this search you have the results grouped for occurrencies, so you can have the values different than the most events, I cannot see any other way to have the differences than  the usual value, unless there is a possibility to prevently define the waited value.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 08:54:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495676#M194603</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-05-11T08:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: help with if-else statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495677#M194604</link>
      <description>&lt;P&gt;i think i did not explain myself well... &lt;/P&gt;

&lt;P&gt;let say i have 5 different eventtypes.. &lt;BR /&gt;
each one of them gets count value.. &lt;BR /&gt;
for the example, each one of them gets the value 1.. &lt;BR /&gt;
if the count value of all the eventtypes is equal than all is OK. but if the value is not equal i have to act as written in the question.. so.. if 4 of the eventtypes has the value 1 and one of them has the value 0 than it is not OK. i have to find those rows where there is different between the count value for each time stamp. &lt;BR /&gt;
after i will find this i have to do the rest of the description in my question.. &lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 09:17:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-with-if-else-statement/m-p/495677#M194604</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2020-05-11T09:17:15Z</dc:date>
    </item>
  </channel>
</rss>

