<?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: Fieldalias Override another Fieldalias in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386657#M169524</link>
    <description>&lt;P&gt;woodcock is on the right track here. Best method for this from my investigation on several cases as a Splunk TSE yielded the following:&lt;/P&gt;

&lt;P&gt;Index time method to accomplish ONE field, renamed as MULTIPLE field names:&lt;/P&gt;

&lt;P&gt;EVAL-foo = coalesce (field1,field2,etc...) thus creating indexed data that combines multiple disparate sourcetypes into one common fieldname as indexed. &lt;/P&gt;

&lt;P&gt;Further info:&lt;/P&gt;

&lt;P&gt;If you have defined a field alias, Splunk will only view the alias name as the data that is being turned into that field name, so for example:&lt;/P&gt;

&lt;P&gt;FIELDALIAS- =  AS foo&lt;/P&gt;

&lt;P&gt;FIELDALIAS- =  AS bar&lt;/P&gt;

&lt;P&gt;FIELDALIAS- = foo AS &lt;/P&gt;

&lt;P&gt;Using this example from above, and with the condition that there is a secondary sourcetype that already ingests a field with the name of 'foo" the following condition will occur -&lt;/P&gt;

&lt;P&gt;The data that comes in natively as 'foo' will not return under these conditions, as Auto-KV extracts the native field of foo [no longer indexing the data as 'foo'], and is also parsing the new field alias for foo, however, since  != foo this causes a break. The break is that the native 'foo' data will then be overwritten as a null value because it will not include  data, thus the field 'foo' will be treated as an empty field with no data. Along with this, multiple iterations of the FIELDALIAS within different app contexts can negatively impact one another and cause "missing data" based on order of operations, and which field ends up overwriting the others, though this behavior may be dependent upon app permissions/sharing.&lt;/P&gt;

&lt;P&gt;Prior to 7.2.0, to tie multiple disparate sourcetypes to a single field name, you would have to ingest them all with different names and then perform an EVAL(coalesce) function at search time to make field1,field2, ... all come out as a singular field name similar to the following:&lt;/P&gt;

&lt;P&gt;| eval foo=coalesce(field1,field2,field*...)&lt;/P&gt;

&lt;P&gt;POST 7.2.0 the ability to inject an EVAL statement at indexing time was introduced, allowing for props.conf entries to create the following:&lt;/P&gt;

&lt;P&gt;EVAL-foo = coalesce (field1,field2,...) thus creating indexed data that combines multiple disparate sourcetypes into one common fieldname as indexed.&lt;/P&gt;

&lt;P&gt;For expected field alias behavior, the following applies:&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;FIELDALIAS- =  AS foo&lt;/P&gt;

&lt;P&gt;FIELDALIAS- =  AS bar&lt;/P&gt;

&lt;H2&gt;The above will work as expected.&lt;/H2&gt;

&lt;P&gt;For examples of usage that will NOT work, the following applies:&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;FIELDALIAS- =  AS foo&lt;/P&gt;

&lt;P&gt;FIELDALIAS- =  AS foo&lt;/P&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;P&gt;FIELDALIAS- =  AS foo&lt;/P&gt;

&lt;P&gt;FIELDALIAS- =  AS bar&lt;/P&gt;

&lt;P&gt;FIELDALIAS- = foo AS &lt;/P&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;P&gt;Multiple iterations of&lt;/P&gt;

&lt;P&gt;App-Context1 props.conf FIELDALIAS- =  AS foo&lt;/P&gt;

&lt;P&gt;App-Context2 props.conf FIELDALIAS- =  AS foo&lt;/P&gt;

&lt;P&gt;App-Context3 props.conf FIELDALIAS- =  AS foo&lt;/P&gt;

&lt;H2&gt;Above examples at index time will fail, as an expected behavior.&lt;/H2&gt;</description>
    <pubDate>Thu, 01 Aug 2019 23:04:29 GMT</pubDate>
    <dc:creator>lwest_splunk</dc:creator>
    <dc:date>2019-08-01T23:04:29Z</dc:date>
    <item>
      <title>Fieldalias Override another Fieldalias</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386649#M169516</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a props file which contains the following:&lt;/P&gt;

&lt;P&gt;FIELDALIAS-aob_gen_alias_4 = dst AS dest&lt;BR /&gt;
FIELDALIAS-aob_gen_alias_5 = destination AS dest&lt;/P&gt;

&lt;P&gt;In case I have some logs with both fields (dst, destination), the final result is that the dest field contains the values of destination field ONLY and not dst &amp;amp; destination.&lt;/P&gt;

&lt;P&gt;Can someone tell me whats wrong with my conf file?&lt;BR /&gt;
Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:27:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386649#M169516</guid>
      <dc:creator>shayhibah</dc:creator>
      <dc:date>2020-09-29T19:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: Fieldalias Override another Fieldalias</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386650#M169517</link>
      <description>&lt;P&gt;What is your desired outcome?&lt;/P&gt;

&lt;P&gt;If you are aiming at having dest as a multivalued field in those cases where the event contains dst and destination, you should look at something else than field aliases.&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 14:01:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386650#M169517</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-05-09T14:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Fieldalias Override another Fieldalias</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386651#M169518</link>
      <description>&lt;P&gt;I want that dest will contains both dst &amp;amp; destination values&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 15:02:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386651#M169518</guid>
      <dc:creator>shayhibah</dc:creator>
      <dc:date>2018-05-09T15:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: Fieldalias Override another Fieldalias</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386652#M169519</link>
      <description>&lt;P&gt;With field aliases, in case of multiple entries with same target/renamed field name, the one that's applied last will take precedence. Since you want the rename to work conditionally (based on availability of field dst and destination, try the calculated field, like this (props.conf on your search head)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EVAL-dest = case(isnotnull(dst) AND isnotnull(destination),dst.",".destination,isnotnull(dst),dst,true(),destination)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 May 2018 16:32:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386652#M169519</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-05-09T16:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: Fieldalias Override another Fieldalias</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386653#M169520</link>
      <description>&lt;P&gt;This would be better done as a &lt;CODE&gt;Calculated field&lt;/CODE&gt; defined like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;dest = coalesce(destination, dst)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 May 2018 05:39:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386653#M169520</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-05-10T05:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: Fieldalias Override another Fieldalias</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386654#M169521</link>
      <description>&lt;P&gt;Coalesce will only get him the  first non-null value. He wants both values in the field in case both exist.&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2018 08:04:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386654#M169521</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-05-10T08:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: Fieldalias Override another Fieldalias</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386655#M169522</link>
      <description>&lt;P&gt;If you need BOTH, then you need a &lt;CODE&gt;Calculated field&lt;/CODE&gt; defined like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;dest = mvappend(destination, dst)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 May 2018 14:36:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386655#M169522</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-05-10T14:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Fieldalias Override another Fieldalias</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386656#M169523</link>
      <description>&lt;P&gt;See new answer.&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2018 14:36:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386656#M169523</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-05-10T14:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Fieldalias Override another Fieldalias</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386657#M169524</link>
      <description>&lt;P&gt;woodcock is on the right track here. Best method for this from my investigation on several cases as a Splunk TSE yielded the following:&lt;/P&gt;

&lt;P&gt;Index time method to accomplish ONE field, renamed as MULTIPLE field names:&lt;/P&gt;

&lt;P&gt;EVAL-foo = coalesce (field1,field2,etc...) thus creating indexed data that combines multiple disparate sourcetypes into one common fieldname as indexed. &lt;/P&gt;

&lt;P&gt;Further info:&lt;/P&gt;

&lt;P&gt;If you have defined a field alias, Splunk will only view the alias name as the data that is being turned into that field name, so for example:&lt;/P&gt;

&lt;P&gt;FIELDALIAS- =  AS foo&lt;/P&gt;

&lt;P&gt;FIELDALIAS- =  AS bar&lt;/P&gt;

&lt;P&gt;FIELDALIAS- = foo AS &lt;/P&gt;

&lt;P&gt;Using this example from above, and with the condition that there is a secondary sourcetype that already ingests a field with the name of 'foo" the following condition will occur -&lt;/P&gt;

&lt;P&gt;The data that comes in natively as 'foo' will not return under these conditions, as Auto-KV extracts the native field of foo [no longer indexing the data as 'foo'], and is also parsing the new field alias for foo, however, since  != foo this causes a break. The break is that the native 'foo' data will then be overwritten as a null value because it will not include  data, thus the field 'foo' will be treated as an empty field with no data. Along with this, multiple iterations of the FIELDALIAS within different app contexts can negatively impact one another and cause "missing data" based on order of operations, and which field ends up overwriting the others, though this behavior may be dependent upon app permissions/sharing.&lt;/P&gt;

&lt;P&gt;Prior to 7.2.0, to tie multiple disparate sourcetypes to a single field name, you would have to ingest them all with different names and then perform an EVAL(coalesce) function at search time to make field1,field2, ... all come out as a singular field name similar to the following:&lt;/P&gt;

&lt;P&gt;| eval foo=coalesce(field1,field2,field*...)&lt;/P&gt;

&lt;P&gt;POST 7.2.0 the ability to inject an EVAL statement at indexing time was introduced, allowing for props.conf entries to create the following:&lt;/P&gt;

&lt;P&gt;EVAL-foo = coalesce (field1,field2,...) thus creating indexed data that combines multiple disparate sourcetypes into one common fieldname as indexed.&lt;/P&gt;

&lt;P&gt;For expected field alias behavior, the following applies:&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;FIELDALIAS- =  AS foo&lt;/P&gt;

&lt;P&gt;FIELDALIAS- =  AS bar&lt;/P&gt;

&lt;H2&gt;The above will work as expected.&lt;/H2&gt;

&lt;P&gt;For examples of usage that will NOT work, the following applies:&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;FIELDALIAS- =  AS foo&lt;/P&gt;

&lt;P&gt;FIELDALIAS- =  AS foo&lt;/P&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;P&gt;FIELDALIAS- =  AS foo&lt;/P&gt;

&lt;P&gt;FIELDALIAS- =  AS bar&lt;/P&gt;

&lt;P&gt;FIELDALIAS- = foo AS &lt;/P&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;P&gt;Multiple iterations of&lt;/P&gt;

&lt;P&gt;App-Context1 props.conf FIELDALIAS- =  AS foo&lt;/P&gt;

&lt;P&gt;App-Context2 props.conf FIELDALIAS- =  AS foo&lt;/P&gt;

&lt;P&gt;App-Context3 props.conf FIELDALIAS- =  AS foo&lt;/P&gt;

&lt;H2&gt;Above examples at index time will fail, as an expected behavior.&lt;/H2&gt;</description>
      <pubDate>Thu, 01 Aug 2019 23:04:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386657#M169524</guid>
      <dc:creator>lwest_splunk</dc:creator>
      <dc:date>2019-08-01T23:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Fieldalias Override another Fieldalias</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386658#M169525</link>
      <description>&lt;P&gt;I pretty much agree with what you said except that &lt;CODE&gt;EVAL-&lt;/CODE&gt; is the original &lt;CODE&gt;search-time&lt;/CODE&gt; field extraction that does not create an indexed field.  I think that you meant &lt;CODE&gt;INGEST_EVAL-&lt;/CODE&gt; for &lt;CODE&gt;index-time&lt;/CODE&gt; extractions created indexed fields.  Also your example seems to imply that transitive field aliases work but they DO NOT.  If you do alias &lt;CODE&gt;foo&lt;/CODE&gt; to &lt;CODE&gt;bar&lt;/CODE&gt; and you have a &lt;CODE&gt;foo&lt;/CODE&gt;, you will get a &lt;CODE&gt;bar&lt;/CODE&gt; but if you further alias &lt;CODE&gt;bar&lt;/CODE&gt; to &lt;CODE&gt;bat&lt;/CODE&gt;, you will NOT get a &lt;CODE&gt;bat&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 23:47:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fieldalias-Override-another-Fieldalias/m-p/386658#M169525</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-08-01T23:47:06Z</dc:date>
    </item>
  </channel>
</rss>

