<?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 to handle a field alias for two fields in search results when the source type is the same? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-handle-a-field-alias-for-two-fields-in-search-results/m-p/236995#M46043</link>
    <description>&lt;P&gt;If it is an &lt;CODE&gt;eventtype&lt;/CODE&gt; then you can obscure the fact that there are 2 fields by making it use the search &lt;CODE&gt;serialnumber1="MyValue" OR serialnumber2="MyValue"&lt;/CODE&gt;.  Then you can access it through a macro that adds the &lt;CODE&gt;coalesce&lt;/CODE&gt; command so your search would be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`MyMacro` | rest of your search
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 11 Mar 2017 16:53:21 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-03-11T16:53:21Z</dc:date>
    <item>
      <title>How to handle a field alias for two fields in search results when the source type is the same?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-handle-a-field-alias-for-two-fields-in-search-results/m-p/236992#M46040</link>
      <description>&lt;P&gt;We have data which can display a computer's serial number. The data is a little odd and we have to extract the serial number using 1 rex and 1 is done automatically. This creates 2 fields &lt;STRONG&gt;serialnumber1&lt;/STRONG&gt; &amp;amp; &lt;STRONG&gt;serialnumber2&lt;/STRONG&gt; .&lt;/P&gt;

&lt;P&gt;I've tried to create an alias called &lt;STRONG&gt;serialnumber&lt;/STRONG&gt;, but I've run into problems.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Applies to sourcetype = imap
Field aliases &amp;gt;  serialnumber1 =serialnumber
Field aliases &amp;gt;  serialnumber2 =serialnumber
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is that when both fields are populated, serialnumber is populated&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;1. When serialnumber1 is NULL and serialnumber2 is populated, "serialnumber" is populated
2. When serialnumber1 is populated and serialnumber2 is NULL,"serialnumber" IS NOT POPULATED
3. When Both serialnumber1 &amp;amp; serialnumber2 are populated, "serialnumber" is populated
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Why is this case that when search result 2. above is true the aliases fail. &lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 16:37:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-handle-a-field-alias-for-two-fields-in-search-results/m-p/236992#M46040</guid>
      <dc:creator>arrowecssupport</dc:creator>
      <dc:date>2016-11-23T16:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle a field alias for two fields in search results when the source type is the same?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-handle-a-field-alias-for-two-fields-in-search-results/m-p/236993#M46041</link>
      <description>&lt;P&gt;Hi arrowecssupport,&lt;BR /&gt;
if you can fix a priority in fields use, you could you coalesce function:&lt;BR /&gt;
| eval serialnumber=coalesce(serialnumber1,serialnumber2)&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 16:48:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-handle-a-field-alias-for-two-fields-in-search-results/m-p/236993#M46041</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2016-11-23T16:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle a field alias for two fields in search results when the source type is the same?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-handle-a-field-alias-for-two-fields-in-search-results/m-p/236994#M46042</link>
      <description>&lt;P&gt;Thanks that appears to work and might work in some situations.&lt;BR /&gt;
Problem is want to be able to create a search into an Event type and this isn't possible when you use a pipe.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2016 15:00:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-handle-a-field-alias-for-two-fields-in-search-results/m-p/236994#M46042</guid>
      <dc:creator>arrowecssupport</dc:creator>
      <dc:date>2016-11-24T15:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle a field alias for two fields in search results when the source type is the same?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-handle-a-field-alias-for-two-fields-in-search-results/m-p/236995#M46043</link>
      <description>&lt;P&gt;If it is an &lt;CODE&gt;eventtype&lt;/CODE&gt; then you can obscure the fact that there are 2 fields by making it use the search &lt;CODE&gt;serialnumber1="MyValue" OR serialnumber2="MyValue"&lt;/CODE&gt;.  Then you can access it through a macro that adds the &lt;CODE&gt;coalesce&lt;/CODE&gt; command so your search would be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`MyMacro` | rest of your search
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 11 Mar 2017 16:53:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-handle-a-field-alias-for-two-fields-in-search-results/m-p/236995#M46043</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-11T16:53:21Z</dc:date>
    </item>
  </channel>
</rss>

