<?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: Defining 1 field that appears 2 different ways for an old and new REST API? in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Defining-1-field-that-appears-2-different-ways-for-an-old-and/m-p/107600#M7563</link>
    <description>&lt;P&gt;You can simply either define two extractions, or a single extraction with an alternating regex. An extraction that fails will simply have no effect (other than the consume the resources of checking for the match).&lt;/P&gt;

&lt;P&gt;e.g.:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-v1 = /2.0/(?&amp;lt;apikey&amp;gt;[^\/]*)/ from uri
EXTRACT-v2 = /query.json?apikey=(?&amp;lt;apikey&amp;gt;[^\=\&amp;amp;]*) from uri
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The second extract could also be performed automatically by an appropriate KV extraction using DELIMS or KV_MODE. &lt;/P&gt;</description>
    <pubDate>Tue, 03 Apr 2012 00:32:30 GMT</pubDate>
    <dc:creator>gkanapathy</dc:creator>
    <dc:date>2012-04-03T00:32:30Z</dc:date>
    <item>
      <title>Defining 1 field that appears 2 different ways for an old and new REST API?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Defining-1-field-that-appears-2-different-ways-for-an-old-and/m-p/107599#M7562</link>
      <description>&lt;P&gt;What is the best approach to defining a field (the user API key field) that in our logs appears in 2 different ways because we take different requests from both an old and a new REST interface?&lt;/P&gt;

&lt;P&gt;The apiKey field exists in each REST API differently:&lt;/P&gt;

&lt;P&gt;Request API Version 1:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; /2.0/APIKEY-GOES-HERE/query.json?param1=value1&amp;amp;param2=value2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Request API Version 2:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/query.json?apikey=APIKEY-GOES-HERE&amp;amp;param1=value1&amp;amp;param2=value2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Apr 2012 00:16:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Defining-1-field-that-appears-2-different-ways-for-an-old-and/m-p/107599#M7562</guid>
      <dc:creator>boris</dc:creator>
      <dc:date>2012-04-03T00:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: Defining 1 field that appears 2 different ways for an old and new REST API?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Defining-1-field-that-appears-2-different-ways-for-an-old-and/m-p/107600#M7563</link>
      <description>&lt;P&gt;You can simply either define two extractions, or a single extraction with an alternating regex. An extraction that fails will simply have no effect (other than the consume the resources of checking for the match).&lt;/P&gt;

&lt;P&gt;e.g.:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-v1 = /2.0/(?&amp;lt;apikey&amp;gt;[^\/]*)/ from uri
EXTRACT-v2 = /query.json?apikey=(?&amp;lt;apikey&amp;gt;[^\=\&amp;amp;]*) from uri
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The second extract could also be performed automatically by an appropriate KV extraction using DELIMS or KV_MODE. &lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2012 00:32:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Defining-1-field-that-appears-2-different-ways-for-an-old-and/m-p/107600#M7563</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2012-04-03T00:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Defining 1 field that appears 2 different ways for an old and new REST API?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Defining-1-field-that-appears-2-different-ways-for-an-old-and/m-p/107601#M7564</link>
      <description>&lt;P&gt;For the novice: gkanapathy answer of using &lt;A href="http://www.regular-expressions.info/alternation.html"&gt;alternating regex&lt;/A&gt; refers to using "OR" with a '|' within the regex. See my below solution: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-v3 = (/2`\`.0/|apikey=)(?&amp;lt;apikey&amp;gt;[^\/]*)/
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Apr 2012 17:13:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Defining-1-field-that-appears-2-different-ways-for-an-old-and/m-p/107601#M7564</guid>
      <dc:creator>boris</dc:creator>
      <dc:date>2012-04-09T17:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: Defining 1 field that appears 2 different ways for an old and new REST API?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Defining-1-field-that-appears-2-different-ways-for-an-old-and/m-p/107602#M7565</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Field aliases to normalize different field names&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Source: &lt;A href="http://docs.splunk.com/Documentation/Splunk/4.3.1/User/TagAndAliasFieldValues"&gt;http://docs.splunk.com/Documentation/Splunk/4.3.1/User/TagAndAliasFieldValues&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Quote from docs:&lt;/P&gt;

&lt;P&gt;"&lt;BR /&gt;
Alias field names&lt;/P&gt;

&lt;P&gt;You can add multiple aliases to a field name or &lt;STRONG&gt;use these field aliases to normalize different field names. This does not rename or remove the original field name.&lt;/STRONG&gt; After you alias a field, you can search for it using any of its name aliases. To alias a field name, you need to have access to props.conf. For information on how to do this, see &lt;A href="http://docs.splunk.com/Documentation/Splunk/4.3.1/Knowledge/Addaliasestofields"&gt;Create aliases for fields&lt;/A&gt; in the Knowledge Manager manual.&lt;BR /&gt;
"&lt;/P&gt;</description>
      <pubDate>Mon, 16 Apr 2012 16:53:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Defining-1-field-that-appears-2-different-ways-for-an-old-and/m-p/107602#M7565</guid>
      <dc:creator>boris</dc:creator>
      <dc:date>2012-04-16T16:53:06Z</dc:date>
    </item>
  </channel>
</rss>

