<?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: Top with optional field results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Top-with-optional-field-results/m-p/705235#M238821</link>
    <description>&lt;P&gt;You did mention that field2 doesn't exist and that is exactly what fillnull will do. It will create a field in an event where there is no field for that event and it gives it the value you specify.&lt;/P&gt;&lt;P&gt;So when you say it didn't work, can you elaborate - what didn't work. field2 WILL be created if it does not exist in a log source where there is no field2 value, so &lt;STRONG&gt;top field1 field2 field3 field4&lt;/STRONG&gt; will not ignore results where field2 does not exist, because after fillnull, it will ALWAYS exist.&lt;/P&gt;&lt;P&gt;Perhaps you can show examples of the data and your SPL&lt;/P&gt;</description>
    <pubDate>Tue, 26 Nov 2024 02:20:39 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2024-11-26T02:20:39Z</dc:date>
    <item>
      <title>Top with optional field results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Top-with-optional-field-results/m-p/705226#M238817</link>
      <description>&lt;P&gt;When I search I want to show the top results by a specific field "field1" and also show "field2" and "field3". Problem is some results don't have a "field2", but do contain the other fields. I get different results when I search if I include a "field2" in the results. Can I search and return all results weather or not "field2" exists?&lt;/P&gt;&lt;P&gt;| top field1 = all possible results&lt;BR /&gt;| top field1 field2 field3 = only results with all fields&lt;BR /&gt;&lt;BR /&gt;What I want is just to show a blank line where "field2" would be on matches that don't have a "field2". Basically make "field2" optional.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 21:20:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Top-with-optional-field-results/m-p/705226#M238817</guid>
      <dc:creator>thrtnastrx</dc:creator>
      <dc:date>2024-11-25T21:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: Top with optional field results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Top-with-optional-field-results/m-p/705228#M238818</link>
      <description>&lt;P&gt;Use&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| fillnull field2 value=""&lt;/LI-CODE&gt;&lt;P&gt;That will force all events with no field2 to have an empty value, rather than a null value.&lt;/P&gt;&lt;P&gt;That's the normal way to force potentially null fields to exist when using them in split by clauses, or top, as in your case.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 21:29:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Top-with-optional-field-results/m-p/705228#M238818</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-11-25T21:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: Top with optional field results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Top-with-optional-field-results/m-p/705232#M238819</link>
      <description>&lt;P&gt;Thanks for the reply but that didn't work; I should have mentioned that "field2" doesn't exist in the source data in some of the logs.&amp;nbsp;&amp;nbsp; So some logs are:&lt;/P&gt;&lt;P&gt;field1, field2, field3, field4&lt;/P&gt;&lt;P&gt;and others are&lt;/P&gt;&lt;P&gt;field1, field3, field4,&lt;/P&gt;&lt;P&gt;So the header "field2" doesn't exist at all in some of the data.&amp;nbsp; I want to return result weather or not they have a "field2".&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 23:59:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Top-with-optional-field-results/m-p/705232#M238819</guid>
      <dc:creator>thrtnastrx</dc:creator>
      <dc:date>2024-11-25T23:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Top with optional field results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Top-with-optional-field-results/m-p/705235#M238821</link>
      <description>&lt;P&gt;You did mention that field2 doesn't exist and that is exactly what fillnull will do. It will create a field in an event where there is no field for that event and it gives it the value you specify.&lt;/P&gt;&lt;P&gt;So when you say it didn't work, can you elaborate - what didn't work. field2 WILL be created if it does not exist in a log source where there is no field2 value, so &lt;STRONG&gt;top field1 field2 field3 field4&lt;/STRONG&gt; will not ignore results where field2 does not exist, because after fillnull, it will ALWAYS exist.&lt;/P&gt;&lt;P&gt;Perhaps you can show examples of the data and your SPL&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2024 02:20:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Top-with-optional-field-results/m-p/705235#M238821</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-11-26T02:20:39Z</dc:date>
    </item>
  </channel>
</rss>

