<?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 do I convert a country name to country code (or vice versa)? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-country-name-to-country-code-or-vice-versa/m-p/425239#M121936</link>
    <description>&lt;P&gt;@nick405060, I think you have implemented an incorrect approach for lookup file. You have indexed the lookup file instead of adding the same as Lookup file and creating Lookup Definition.&lt;/P&gt;

&lt;P&gt;Refer to Splunk Documentation for &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Usefieldlookupstoaddinformationtoyourevents"&gt;Defining Lookup in Splunk&lt;/A&gt;. Once you have configured the same you can use &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Lookup"&gt;lookup&lt;/A&gt; and &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Inputlookup"&gt;inputlookup&lt;/A&gt; command to perform Country to Country Code and vice versa correlation depending on what is the field present in your data.&lt;/P&gt;

&lt;P&gt;While the documentation links posted above have examples for each command. You can also search Splunk Answers for similar use cases. Following are couple of previous answers on similar lines:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/132299/extracting-country-codes-from-phone-numbers.html"&gt;https://answers.splunk.com/answers/132299/extracting-country-codes-from-phone-numbers.html&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/378193/is-it-possible-to-use-a-countrycode-us-for-the-geo.html"&gt;https://answers.splunk.com/answers/378193/is-it-possible-to-use-a-countrycode-us-for-the-geo.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Aug 2018 19:12:15 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2018-08-23T19:12:15Z</dc:date>
    <item>
      <title>How do I convert a country name to country code (or vice versa)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-country-name-to-country-code-or-vice-versa/m-p/425234#M121931</link>
      <description>&lt;P&gt;How do I convert a CC to a country name in Splunk, or vice versa? &lt;/P&gt;

&lt;P&gt;Since Splunk Answers won't let me post this question without it being longer (#logic), I need to do:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval cc="US" | eval country="United States" | &amp;lt;test if they are equal&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Aug 2018 17:46:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-country-name-to-country-code-or-vice-versa/m-p/425234#M121931</guid>
      <dc:creator>nick405060</dc:creator>
      <dc:date>2018-08-23T17:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a country name to country code (or vice versa)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-country-name-to-country-code-or-vice-versa/m-p/425235#M121932</link>
      <description>&lt;P&gt;you can use the replace command to do this.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/568552/how-to-use-replace-in-search.html"&gt;https://answers.splunk.com/answers/568552/how-to-use-replace-in-search.html&lt;/A&gt;&lt;BR /&gt;
Let me know if this helps.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 18:07:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-country-name-to-country-code-or-vice-versa/m-p/425235#M121932</guid>
      <dc:creator>pruthvikrishnap</dc:creator>
      <dc:date>2018-08-23T18:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a country name to country code (or vice versa)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-country-name-to-country-code-or-vice-versa/m-p/425236#M121933</link>
      <description>&lt;P&gt;That wouldn't work because CCs aren't uniform. FR is the first two characters of the country name, while US is the first and eighth character of the country name, CN is the first and fourth letter of the country name.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 18:18:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-country-name-to-country-code-or-vice-versa/m-p/425236#M121933</guid>
      <dc:creator>nick405060</dc:creator>
      <dc:date>2018-08-23T18:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a country name to country code (or vice versa)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-country-name-to-country-code-or-vice-versa/m-p/425237#M121934</link>
      <description>&lt;P&gt;if you have a list of CC's try adding them to a lookup file which would be much easier.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 18:37:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-country-name-to-country-code-or-vice-versa/m-p/425237#M121934</guid>
      <dc:creator>pruthvikrishnap</dc:creator>
      <dc:date>2018-08-23T18:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a country name to country code (or vice versa)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-country-name-to-country-code-or-vice-versa/m-p/425238#M121935</link>
      <description>&lt;P&gt;Yeah, that's what I ended up doing. Not super elegant but whatever. A moderator can convert your comment to an answer if they want. I just created country_codes.csv and then left joined my data with it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;data&amp;gt; | join type=left Country [| search source="country_codes.csv" | table CC Country]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Aug 2018 18:51:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-country-name-to-country-code-or-vice-versa/m-p/425238#M121935</guid>
      <dc:creator>nick405060</dc:creator>
      <dc:date>2018-08-23T18:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a country name to country code (or vice versa)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-country-name-to-country-code-or-vice-versa/m-p/425239#M121936</link>
      <description>&lt;P&gt;@nick405060, I think you have implemented an incorrect approach for lookup file. You have indexed the lookup file instead of adding the same as Lookup file and creating Lookup Definition.&lt;/P&gt;

&lt;P&gt;Refer to Splunk Documentation for &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Usefieldlookupstoaddinformationtoyourevents"&gt;Defining Lookup in Splunk&lt;/A&gt;. Once you have configured the same you can use &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Lookup"&gt;lookup&lt;/A&gt; and &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Inputlookup"&gt;inputlookup&lt;/A&gt; command to perform Country to Country Code and vice versa correlation depending on what is the field present in your data.&lt;/P&gt;

&lt;P&gt;While the documentation links posted above have examples for each command. You can also search Splunk Answers for similar use cases. Following are couple of previous answers on similar lines:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/132299/extracting-country-codes-from-phone-numbers.html"&gt;https://answers.splunk.com/answers/132299/extracting-country-codes-from-phone-numbers.html&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/378193/is-it-possible-to-use-a-countrycode-us-for-the-geo.html"&gt;https://answers.splunk.com/answers/378193/is-it-possible-to-use-a-countrycode-us-for-the-geo.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 19:12:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-country-name-to-country-code-or-vice-versa/m-p/425239#M121936</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-08-23T19:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a country name to country code (or vice versa)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-country-name-to-country-code-or-vice-versa/m-p/425240#M121937</link>
      <description>&lt;P&gt;Thanks! You're right, I could have used a lookup instead of indexing and joining.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 19:33:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-country-name-to-country-code-or-vice-versa/m-p/425240#M121937</guid>
      <dc:creator>nick405060</dc:creator>
      <dc:date>2018-08-23T19:33:10Z</dc:date>
    </item>
  </channel>
</rss>

