<?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: Coalesce Fields With Values Excluding Nulls in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Coalesce-Fields-With-Values-Excluding-Nulls/m-p/456918#M129132</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147"&gt;@somesoni2&lt;/a&gt; No it means that that log file doesn't have that field. For, example the field transaction_id may be a non-nested key or it could be something like payload.response.transaction_id which is nested. I basically want to melt that into one column, but am having problems with null overwriting the current value. You suggested that I order the columns in increasing sparseness? (i.e. coalesce(4% sparse,20% sparse, 80% sparse))&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 20:36:39 GMT</pubDate>
    <dc:creator>ixixix_spl</dc:creator>
    <dc:date>2020-09-29T20:36:39Z</dc:date>
    <item>
      <title>Coalesce Fields With Values Excluding Nulls</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Coalesce-Fields-With-Values-Excluding-Nulls/m-p/456913#M129127</link>
      <description>&lt;P&gt;I know you can coalesce multiple columns to merge them into one. However, I am currently coalescing around 8 fields, some of which have null values. Because the last field I am including is sparse (only appears in 3% of the logs), I have found that the coalesced field returns as mostly null (matching the last coalesced field). A demonstration of what I'd like to do is below (A_col is first to coalesce then B_col to make C_col and B_col overwrites A_col if the value in B_col is not null). &lt;/P&gt;

&lt;P&gt;Here is the query format I am using&lt;BR /&gt;
 ... | eval name = coalesce(entityName, individualName) | ... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    A demonstration of what I'd like to do (C is a coalesced field of A and B):
    A_col .    B_col .    C_col
    A             Null .      A
    Null .      B .           B
   A .            B .          B
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:36:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Coalesce-Fields-With-Values-Excluding-Nulls/m-p/456913#M129127</guid>
      <dc:creator>ixixix_spl</dc:creator>
      <dc:date>2020-09-29T20:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: Coalesce Fields With Values Excluding Nulls</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Coalesce-Fields-With-Values-Excluding-Nulls/m-p/456914#M129128</link>
      <description>&lt;P&gt;I believe this should work &lt;BR /&gt;
| eval C_col =coalesce(A_col, B_col, C_col)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:35:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Coalesce-Fields-With-Values-Excluding-Nulls/m-p/456914#M129128</guid>
      <dc:creator>ghantk1</dc:creator>
      <dc:date>2020-09-29T20:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Coalesce Fields With Values Excluding Nulls</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Coalesce-Fields-With-Values-Excluding-Nulls/m-p/456915#M129129</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/107842"&gt;@ghantk1&lt;/a&gt; Didn't do it for me, null values are still overwriting if in the last column I am coalescing on ( | eval C_col =coalesce(A_col, B_col, C_col) command makes B_col nulls overwrite A_col non-null values) &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:36:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Coalesce-Fields-With-Values-Excluding-Nulls/m-p/456915#M129129</guid>
      <dc:creator>ixixix_spl</dc:creator>
      <dc:date>2020-09-29T20:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: Coalesce Fields With Values Excluding Nulls</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Coalesce-Fields-With-Values-Excluding-Nulls/m-p/456916#M129130</link>
      <description>&lt;P&gt;Do you have control of the field extractions? If so, why not change the extractions in order to ignore the nulls?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 18:18:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Coalesce-Fields-With-Values-Excluding-Nulls/m-p/456916#M129130</guid>
      <dc:creator>diogofgm</dc:creator>
      <dc:date>2018-07-25T18:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: Coalesce Fields With Values Excluding Nulls</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Coalesce-Fields-With-Values-Excluding-Nulls/m-p/456917#M129131</link>
      <description>&lt;P&gt;The &lt;CODE&gt;Null&lt;/CODE&gt; on your output is actual Splunk's null/blank value or a literal "Null" string? Assuming it's former, specify the 2nd column first in the coalesce command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval C_col=coalesce(B_col, A_col)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That way if B_col is available that will be used, else A_col will be used.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:38:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Coalesce-Fields-With-Values-Excluding-Nulls/m-p/456917#M129131</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T20:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Coalesce Fields With Values Excluding Nulls</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Coalesce-Fields-With-Values-Excluding-Nulls/m-p/456918#M129132</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147"&gt;@somesoni2&lt;/a&gt; No it means that that log file doesn't have that field. For, example the field transaction_id may be a non-nested key or it could be something like payload.response.transaction_id which is nested. I basically want to melt that into one column, but am having problems with null overwriting the current value. You suggested that I order the columns in increasing sparseness? (i.e. coalesce(4% sparse,20% sparse, 80% sparse))&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:36:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Coalesce-Fields-With-Values-Excluding-Nulls/m-p/456918#M129132</guid>
      <dc:creator>ixixix_spl</dc:creator>
      <dc:date>2020-09-29T20:36:39Z</dc:date>
    </item>
  </channel>
</rss>

