<?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 Search top 4 destinations based on usage by IP and put remaining in others for each IP in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-top-4-destinations-based-on-usage-by-IP-and-put-remaining/m-p/399589#M115835</link>
    <description>&lt;P&gt;I am bit new to splunk.&lt;/P&gt;

&lt;P&gt;I want to search top 4 destinations downloads and total ‘Other’ traffic for each source ip.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;site    src_ip  destination           download
ALSTP   10.98.66.5  Youtube          150
ALSTP   10.98.66.5  Google            103
ALSTP   10.98.66.5  Microsoft_Updates   85
ALSTP   10.98.66.5  Dropbox          25
ALSTP   10.98.66.5  Other              430
ALSTP   10.98.70.10   Google              12
ALSTP   10.98.70.10   Youtube            650
ALSTP   10.98.70.10   Apple_Updates    502
ALSTP   10.98.70.10   iTunes              300
ALSTP   10.98.70.10   Other            4040
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried below search but it is not giving the desired result.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| ess eaddr=172.16.9.60:9200 index=nuage_dpi_flowstats-* tsfield=timestamp query="EnterpriseName=Lismore Diocese" 
| eval _time=strftime(_time/1000, "%Y-%m-%d %H:%M:%S") 
| stats sum(TotalMB) as "Total(MB)" by DstIp, L7ClassEnhanced, DestinationNSG 
| sort 5 -"Total(MB)"
| addcoltotals labelfield=L7ClassEnhanced label=Others 
| rename L7ClassEnhanced as Destination, DstIp as SrcIp, DestinationNSG as SourceNSG 
| search NOT SourceNSG=ULT1_NSGX1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SrcIp             Destination             SourceNSG              Total(MB)
10.102.57.21       HTTP                  PMAC_NSG1      395.26492023463334
10.101.144.193   GOOGLE                CASH_NSG1        88.199470520036470
10.101.148.114   YOUTUBE                  CASH_NSG1     201.709753036428500
10.102.81.44       SSL                    PMREG_NSG1       163.37909603115
                                           Others           5072.701299667548000
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 30 May 2019 04:07:08 GMT</pubDate>
    <dc:creator>ahmadsaadwarrai</dc:creator>
    <dc:date>2019-05-30T04:07:08Z</dc:date>
    <item>
      <title>Search top 4 destinations based on usage by IP and put remaining in others for each IP</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-top-4-destinations-based-on-usage-by-IP-and-put-remaining/m-p/399589#M115835</link>
      <description>&lt;P&gt;I am bit new to splunk.&lt;/P&gt;

&lt;P&gt;I want to search top 4 destinations downloads and total ‘Other’ traffic for each source ip.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;site    src_ip  destination           download
ALSTP   10.98.66.5  Youtube          150
ALSTP   10.98.66.5  Google            103
ALSTP   10.98.66.5  Microsoft_Updates   85
ALSTP   10.98.66.5  Dropbox          25
ALSTP   10.98.66.5  Other              430
ALSTP   10.98.70.10   Google              12
ALSTP   10.98.70.10   Youtube            650
ALSTP   10.98.70.10   Apple_Updates    502
ALSTP   10.98.70.10   iTunes              300
ALSTP   10.98.70.10   Other            4040
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried below search but it is not giving the desired result.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| ess eaddr=172.16.9.60:9200 index=nuage_dpi_flowstats-* tsfield=timestamp query="EnterpriseName=Lismore Diocese" 
| eval _time=strftime(_time/1000, "%Y-%m-%d %H:%M:%S") 
| stats sum(TotalMB) as "Total(MB)" by DstIp, L7ClassEnhanced, DestinationNSG 
| sort 5 -"Total(MB)"
| addcoltotals labelfield=L7ClassEnhanced label=Others 
| rename L7ClassEnhanced as Destination, DstIp as SrcIp, DestinationNSG as SourceNSG 
| search NOT SourceNSG=ULT1_NSGX1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SrcIp             Destination             SourceNSG              Total(MB)
10.102.57.21       HTTP                  PMAC_NSG1      395.26492023463334
10.101.144.193   GOOGLE                CASH_NSG1        88.199470520036470
10.101.148.114   YOUTUBE                  CASH_NSG1     201.709753036428500
10.102.81.44       SSL                    PMREG_NSG1       163.37909603115
                                           Others           5072.701299667548000
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 May 2019 04:07:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-top-4-destinations-based-on-usage-by-IP-and-put-remaining/m-p/399589#M115835</guid>
      <dc:creator>ahmadsaadwarrai</dc:creator>
      <dc:date>2019-05-30T04:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Search top 4 destinations based on usage by IP and put remaining in others for each IP</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-top-4-destinations-based-on-usage-by-IP-and-put-remaining/m-p/399590#M115836</link>
      <description>&lt;P&gt;You will need to use stats in combination with eval to calculate a sum of the bytes for download traffic and non-download traffic. Hopefully there is a key in your data that will help you differentiate. Here is an example&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo
| stats sum(eval(if(action="download", TotalMB, NULL))) AS download_traffic sum(eval(if(action!="download", TotalMB, NULL))) AS other_traffic by src_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For reference: &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.6/Search/Usestatswithevalexpressionsandfunctions"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.6/Search/Usestatswithevalexpressionsandfunctions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 13:57:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-top-4-destinations-based-on-usage-by-IP-and-put-remaining/m-p/399590#M115836</guid>
      <dc:creator>pkeenan87</dc:creator>
      <dc:date>2019-05-30T13:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Search top 4 destinations based on usage by IP and put remaining in others for each IP</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-top-4-destinations-based-on-usage-by-IP-and-put-remaining/m-p/399591#M115837</link>
      <description>&lt;P&gt;Thanks for the reply, I don't want to differentiate download and non-download traffic, &lt;/P&gt;

&lt;P&gt;I want to list top 4 destination based on usage and all others destinations as "Others" for each ip, like below:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;  site          src_ip             destination              download(MB)&lt;/LI&gt;
&lt;LI&gt;  ALSTP     10.98.66.5     Youtube                    150&lt;/LI&gt;
&lt;LI&gt;  ALSTP     10.98.66.5     Google                       103&lt;/LI&gt;
&lt;LI&gt;  ALSTP     10.98.66.5     Microsoft_Updates   85&lt;/LI&gt;
&lt;LI&gt;  ALSTP     10.98.66.5     Dropbox                     25&lt;/LI&gt;
&lt;LI&gt;  ALSTP     10.98.66.5     Other                          430&lt;/LI&gt;
&lt;LI&gt;  ALSTP     10.98.70.10   Google                        12&lt;/LI&gt;
&lt;LI&gt;  ALSTP     10.98.70.10   Youtube                      650&lt;/LI&gt;
&lt;LI&gt;  ALSTP     10.98.70.10   Apple_Updates          502&lt;/LI&gt;
&lt;LI&gt;ALSTP     10.98.70.10   iTunes                        300&lt;/LI&gt;
&lt;LI&gt;ALSTP     10.98.70.10   Other                          4040&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Thu, 30 May 2019 23:21:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-top-4-destinations-based-on-usage-by-IP-and-put-remaining/m-p/399591#M115837</guid>
      <dc:creator>ahmadsaadwarrai</dc:creator>
      <dc:date>2019-05-30T23:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: Search top 4 destinations based on usage by IP and put remaining in others for each IP</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-top-4-destinations-based-on-usage-by-IP-and-put-remaining/m-p/399592#M115838</link>
      <description>&lt;P&gt;Below search gives the desired result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| ess eaddr=172.16.9.60:9200 index=nuage_dpi_flowstats-* tsfield=timestamp query="EnterpriseName=Lismore Diocese" 
| eval _time=strftime(_time/1000, "%Y-%m-%d %H:%M:%S") 
| stats sum(TotalMB) as "Total(MB)" by DstIp, L7ClassEnhanced, DestinationNSG 
| sort DstIp -"Total(MB)" 
| eval counter = 1 
| streamstats sum(counter) as seqNo by DstIp 
| eval L7ClassEnhanced=case(seqNo &amp;lt; 5, L7ClassEnhanced, seqNo &amp;gt; 4, "Others") 
| rename "Total(MB)" as TotalMB 
| stats sum(TotalMB) as "Total(MB)" by DstIp, L7ClassEnhanced, DestinationNSG 
| fields - counter seqNo 
| sort DstIp -"Total(MB)" 
| search NOT DestinationNSG=ULT1_NSGX1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Jun 2019 04:11:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-top-4-destinations-based-on-usage-by-IP-and-put-remaining/m-p/399592#M115838</guid>
      <dc:creator>ahmadsaadwarrai</dc:creator>
      <dc:date>2019-06-06T04:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: Search top 4 destinations based on usage by IP and put remaining in others for each IP</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-top-4-destinations-based-on-usage-by-IP-and-put-remaining/m-p/399593#M115839</link>
      <description>&lt;P&gt;@ahmadsaadwarraich If your problem is resolved, please accept an answer to help future readers.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 11:34:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-top-4-destinations-based-on-usage-by-IP-and-put-remaining/m-p/399593#M115839</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-06-06T11:34:31Z</dc:date>
    </item>
  </channel>
</rss>

