<?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 Getting top values from two fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Getting-top-values-from-two-fields/m-p/187990#M54166</link>
    <description>&lt;P&gt;I have a index that contains both destination and source countries in each entry.&lt;BR /&gt;
I would like to get a list over top 10 countries, regardless of the source or destination.&lt;/P&gt;

&lt;P&gt;I have tried something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | top limit=10 srccountry,dstcountry
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But this doesnt work, since it shows top based on both source and destination.&lt;/P&gt;

&lt;P&gt;Something like this I was hoping would work, but clearly doesnt&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | top limit=10 srccountry OR dstcountry
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I was thinking that I could add the results from two searches and addning them, but not sure how to do this.&lt;/P&gt;

&lt;P&gt;Does anybody knows how to solve this? (if possible)&lt;/P&gt;</description>
    <pubDate>Mon, 23 Dec 2013 12:40:42 GMT</pubDate>
    <dc:creator>kennethp</dc:creator>
    <dc:date>2013-12-23T12:40:42Z</dc:date>
    <item>
      <title>Getting top values from two fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-top-values-from-two-fields/m-p/187990#M54166</link>
      <description>&lt;P&gt;I have a index that contains both destination and source countries in each entry.&lt;BR /&gt;
I would like to get a list over top 10 countries, regardless of the source or destination.&lt;/P&gt;

&lt;P&gt;I have tried something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | top limit=10 srccountry,dstcountry
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But this doesnt work, since it shows top based on both source and destination.&lt;/P&gt;

&lt;P&gt;Something like this I was hoping would work, but clearly doesnt&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | top limit=10 srccountry OR dstcountry
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I was thinking that I could add the results from two searches and addning them, but not sure how to do this.&lt;/P&gt;

&lt;P&gt;Does anybody knows how to solve this? (if possible)&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2013 12:40:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-top-values-from-two-fields/m-p/187990#M54166</guid>
      <dc:creator>kennethp</dc:creator>
      <dc:date>2013-12-23T12:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: Getting top values from two fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-top-values-from-two-fields/m-p/187991#M54167</link>
      <description>&lt;P&gt;You could do something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search | eval country = srccountry . ";" . dstcountry | makemv delim=";" country | mvexpand country | top country
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That will make two events for each event, one with country=srccountry and one with country=dstcountry, and then count the top ten countries.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2013 17:12:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-top-values-from-two-fields/m-p/187991#M54167</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-12-23T17:12:15Z</dc:date>
    </item>
  </channel>
</rss>

