<?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 can I separate the event by condition? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226423#M66769</link>
    <description>&lt;P&gt;Sorry may be I described badly in last reply, what I want to filter is the block of service that less than 50 in 5min window for each of the IP address&lt;/P&gt;

&lt;P&gt;Therefore the output without filter is following&lt;BR /&gt;
src_ip  max_Service_Block_Count     total_block     Blocked Service     Block_Count&lt;BR /&gt;
1.2.3.4     1201               12890             SNMP 55&lt;BR /&gt;
                                                                 SNMP 28&lt;/P&gt;

&lt;H2&gt;                                                                 HTTP  1201&lt;/H2&gt;

&lt;P&gt;2.3.4.5       1213               14565            H.323   50&lt;BR /&gt;
                                                                  BGP    123&lt;BR /&gt;
                                                                  AOL      1213&lt;/P&gt;

&lt;P&gt;And expected result after filter is following &lt;/P&gt;

&lt;P&gt;src_ip  max_Service_Block_Count     total_block     Blocked Service     Block_Count&lt;BR /&gt;
1.2.3.4     1201               12890             SNMP 55&lt;/P&gt;

&lt;H2&gt;                                                                 HTTP  1201    &amp;lt;&amp;lt;&amp;lt; SNMP 28 is filtered for this IP address&lt;/H2&gt;

&lt;P&gt;2.3.4.5       1213               14565            H.323   50&lt;BR /&gt;
                                                                  BGP    123&lt;BR /&gt;
                                                                  AOL      1213&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 12:28:36 GMT</pubDate>
    <dc:creator>kcchu01</dc:creator>
    <dc:date>2020-09-29T12:28:36Z</dc:date>
    <item>
      <title>How can I separate the event by condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226414#M66760</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I think it is quite complicated and try to explain clearly. I got the firewall log with the following fields&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;src_ip     action    service           dst_ip     
1.1.1.1    allowed   tcp_8080          1.1.1.2
1.1.1.1    blocked   tcp_8081          2.2.2.2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I want to do is the following.&lt;BR /&gt;
1. Show the top 10 src_ip that with maximum number of blocks in 5 minutes&lt;BR /&gt;
2. For each src_ip, show the service summary of attacks blocked and corresponding number of each service&lt;BR /&gt;
3. For each src_ip, show the service summary of allowed, corresponding number of each service and corresponding dst_ip.&lt;/P&gt;

&lt;P&gt;Therefore the desired table is as below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Src_ip         Blocked Service       Block Count       Allowed Service    Allow Count     Dst_ip for allowed service
1.1.1.1        tcp_8081              100               tcp_8080           20              2.2.2.2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I got stuck in how to separate the service into two based on the condition. In this case, I would like to separate the service into service_allow and service_block based on the "action", I tried to find many information but not help so much.&lt;/P&gt;

&lt;P&gt;Please give me a hand for help. Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:21:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226414#M66760</guid>
      <dc:creator>kcchu01</dc:creator>
      <dc:date>2020-09-29T12:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: How can I separate the event by condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226415#M66761</link>
      <description>&lt;P&gt;Try this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval AlllowedService=if(action="allowed",service,null())
| eval DestIP=if(action="allowed",dest_ip,null())
| eval BlockedService=if(action="blocked",service,null())
| stats values(BlockedService) AS "Blocked Service" count(BlockedService) AS "Block Count" values(AllowedService) AS "Allowed Service" count(AllowedService) AS "Allowed Service" values(DestIP) AS DestIP by src_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If there are a lot of results by src_ip will need to do counts for allowed/blocked separately then something like below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count AS Count by src_ip action service dst_ip
| eval AllowedService=if(action="allowed",service,null())
| eval AllowedServiceCount=if(action="allowed",Count,null())
| eval DestIP=if(action="allowed",dest_ip,null())
| eval BlockedService=if(action="blocked",service,null())
| eval BlockedServiceCount=if(action="blocked",Count,null())
| stats list(BlockedService) AS BlockedService list(BlockedServiceCount) AS BlockedCount list(AllowedService) AS AllowedService list(AllowedServiceCount) AS AllowedCount list(DestIP) AS DestIP by src_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Good luck. Hope this helps. &lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2017 10:03:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226415#M66761</guid>
      <dc:creator>snoobzilla</dc:creator>
      <dc:date>2017-01-11T10:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: How can I separate the event by condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226416#M66762</link>
      <description>&lt;P&gt;No sure where the two "5." are coming from in code markup... delete when using.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2017 10:05:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226416#M66762</guid>
      <dc:creator>snoobzilla</dc:creator>
      <dc:date>2017-01-11T10:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: How can I separate the event by condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226417#M66763</link>
      <description>&lt;P&gt;Any luck with approach above?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 16:52:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226417#M66763</guid>
      <dc:creator>snoobzilla</dc:creator>
      <dc:date>2017-01-16T16:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: How can I separate the event by condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226418#M66764</link>
      <description>&lt;P&gt;Thank you very much, the second approach works with what I want to do.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 07:40:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226418#M66764</guid>
      <dc:creator>kcchu01</dc:creator>
      <dc:date>2017-01-17T07:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: How can I separate the event by condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226419#M66765</link>
      <description>&lt;P&gt;Additional question:  I would like to show top 10 IP addresses that showing the list of block with corresponding number &amp;gt; 50, when I tried to set the condition &lt;/P&gt;

&lt;P&gt;" where BlockedCount&amp;gt;50 "&lt;/P&gt;

&lt;P&gt;it only shows one of the block &amp;gt;50 for that IP address, I tried to sum up all the blocks in two hours and only limiting total number of blocks, it can show that IP containing multiple blocks &amp;gt; 50 but this also showing blocks &amp;lt; 50, what can I do in order to show the block list with blocks &amp;gt; 50 only for that particular IP address?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 08:07:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226419#M66765</guid>
      <dc:creator>kcchu01</dc:creator>
      <dc:date>2017-01-17T08:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can I separate the event by condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226420#M66766</link>
      <description>&lt;P&gt;Not sure I am following. Can you post where you are putting the where in the query?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 12:00:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226420#M66766</guid>
      <dc:creator>snoobzilla</dc:creator>
      <dc:date>2017-01-17T12:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: How can I separate the event by condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226421#M66767</link>
      <description>&lt;P&gt;sourcetype=my_traffic action=blocked OR action=allowed | bin _time span=5m &lt;BR /&gt;
| stats count as Count list(dstip) as dstip by src_ip action service _time &lt;BR /&gt;
| eval.......&amp;lt;&amp;gt;&lt;BR /&gt;
| stats list(BlockedService) AS BlockedService list(BlockedServiceCount) AS BlockedCount list(AllowedService) AS AllowedService list(AllowedServiceCount) AS AllowedCount list(DestIP) AS DestIP by src_ip&lt;/P&gt;

&lt;P&gt;The output would be &lt;BR /&gt;
src_ip  Blocked Service     Block_Count     Service Allowed     Allow Service Count     Destination IP&lt;BR /&gt;
1.2.3.4      SNMP          30&lt;BR /&gt;
                  SNMP          28&lt;BR /&gt;
                  SNMP          3&lt;BR /&gt;
                  SNMP          2&lt;BR /&gt;
                  SNMP          2&lt;/P&gt;

&lt;P&gt;After add the "| where Block_Count&amp;gt;5" at the end , it outputs nothing.&lt;/P&gt;

&lt;P&gt;What I expected for :&lt;BR /&gt;
src_ip  Blocked Service     Block_Count     Service Allowed     Allow Service Count     Destination IP&lt;BR /&gt;
1.2.3.4      SNMP          30&lt;BR /&gt;
                  SNMP          28&lt;/P&gt;

&lt;P&gt;Are there any wrong?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:27:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226421#M66767</guid>
      <dc:creator>kcchu01</dc:creator>
      <dc:date>2020-09-29T12:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: How can I separate the event by condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226422#M66768</link>
      <description>&lt;P&gt;I think I am following. Add what you want to filter on as a sum or max in the second stats command then use that for your filter...&lt;/P&gt;

&lt;P&gt;| stats max(BlockedServiceCount) AS maxBlockedServiceCount sum(BlockedServiceCount) AS sumBlockedServiceCount list(BlockedService) AS BlockedService list(BlockedServiceCount) AS BlockedCount list(AllowedService) AS AllowedService list(AllowedServiceCount) AS AllowedCount list(DestIP) AS DestIP by src_ip&lt;BR /&gt;
| where ...&lt;BR /&gt;
| fields - maxBlockedServiceCount sumBlockedServiceCount &lt;/P&gt;

&lt;P&gt;Does that help?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2017 12:50:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226422#M66768</guid>
      <dc:creator>snoobzilla</dc:creator>
      <dc:date>2017-01-18T12:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: How can I separate the event by condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226423#M66769</link>
      <description>&lt;P&gt;Sorry may be I described badly in last reply, what I want to filter is the block of service that less than 50 in 5min window for each of the IP address&lt;/P&gt;

&lt;P&gt;Therefore the output without filter is following&lt;BR /&gt;
src_ip  max_Service_Block_Count     total_block     Blocked Service     Block_Count&lt;BR /&gt;
1.2.3.4     1201               12890             SNMP 55&lt;BR /&gt;
                                                                 SNMP 28&lt;/P&gt;

&lt;H2&gt;                                                                 HTTP  1201&lt;/H2&gt;

&lt;P&gt;2.3.4.5       1213               14565            H.323   50&lt;BR /&gt;
                                                                  BGP    123&lt;BR /&gt;
                                                                  AOL      1213&lt;/P&gt;

&lt;P&gt;And expected result after filter is following &lt;/P&gt;

&lt;P&gt;src_ip  max_Service_Block_Count     total_block     Blocked Service     Block_Count&lt;BR /&gt;
1.2.3.4     1201               12890             SNMP 55&lt;/P&gt;

&lt;H2&gt;                                                                 HTTP  1201    &amp;lt;&amp;lt;&amp;lt; SNMP 28 is filtered for this IP address&lt;/H2&gt;

&lt;P&gt;2.3.4.5       1213               14565            H.323   50&lt;BR /&gt;
                                                                  BGP    123&lt;BR /&gt;
                                                                  AOL      1213&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:28:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-separate-the-event-by-condition/m-p/226423#M66769</guid>
      <dc:creator>kcchu01</dc:creator>
      <dc:date>2020-09-29T12:28:36Z</dc:date>
    </item>
  </channel>
</rss>

