<?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: Strange behaviour with | table * in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Strange-behaviour-with-table/m-p/366696#M108174</link>
    <description>&lt;P&gt;The answer is that, when you are doing &lt;CODE&gt;sensortype=sens*&lt;/CODE&gt;, the system is doing an expansion of all the fields from the other sensortypes before eliminating those sensortypes that don't match.   This leaves a bunch of NULL fields.&lt;/P&gt;

&lt;P&gt;Of course, &lt;CODE&gt;table *&lt;/CODE&gt; is not best practices anyway -- much better to use only the fields that you need for any given query, and to put them in an explicit &lt;CODE&gt;fields&lt;/CODE&gt; command after the first pipe, to minimize the amount of extraction done by the system.  &lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;For an understanding of why this unexpected behavior is not a bug, you have to understand how searches and bloom filters actually work under the covers.  &lt;/P&gt;

&lt;P&gt;If you look at slide 22 of this .conf2017  presentation by MVP Martin Müller (@martin_mueller) at &lt;A href="https://conf.splunk.com/files/2017/slides/fields-indexed-tokens-and-you.pdf"&gt;https://conf.splunk.com/files/2017/slides/fields-indexed-tokens-and-you.pdf&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;...then you will see this wording...&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;▶ Default assumption: Field values are whole indexed tokens &lt;BR /&gt;
▶ &lt;CODE&gt;exception=java.lang.NullPointerException&lt;/CODE&gt; becomes &lt;CODE&gt;[ AND java lang NullPointerException ]&lt;/CODE&gt;&lt;BR /&gt;
▶ Actual field extractions and post-filtering happens after loading raw events&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;So basically, for the event selection, &lt;CODE&gt;sensortype=sens*&lt;/CODE&gt; initially becomes &lt;CODE&gt;AND sens*&lt;/CODE&gt;, so the initial part of the search is going to find all events that have &lt;CODE&gt;sens*&lt;/CODE&gt; somewhere in them.  That is going to literally be every record with a &lt;CODE&gt;sensortype=&lt;/CODE&gt; in its _raw, since &lt;CODE&gt;sens*&lt;/CODE&gt; will pick up the token&lt;CODE&gt;sensortype&lt;/CODE&gt;.  It will also pick up any other fields that happen to have values starting with sens.&lt;/P&gt;

&lt;P&gt;Since you are coding &lt;CODE&gt;| table *&lt;/CODE&gt; , the system cannot optimize to the fields you are asking for and EVERY field has to be expanded.  Once that all gets expanded, the ones where &lt;CODE&gt;sensortype!=sens*&lt;/CODE&gt; get dropped, but the search still knows all the fields that were created/extracted for any of the events.  &lt;/P&gt;</description>
    <pubDate>Tue, 14 Nov 2017 13:39:16 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-11-14T13:39:16Z</dc:date>
    <item>
      <title>Strange behaviour with | table *</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Strange-behaviour-with-table/m-p/366694#M108172</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I have some issues with the results from using     | table * &lt;/P&gt;

&lt;P&gt;I start with a simple data selection:&lt;/P&gt;

&lt;P&gt;sourcetype=senssordata sensortype="sens*" &lt;BR /&gt;
This gives me 108 events as results.&lt;BR /&gt;
With two different sensortype's , namely: "sens1" and "sens-B".&lt;/P&gt;

&lt;P&gt;Ofcourse this would give me the same result:&lt;/P&gt;

&lt;P&gt;sourcetype=senssordata sensortype="sens1" OR sensortype="sens-B"&lt;BR /&gt;
And it does, It gives the same 108 events as result.&lt;/P&gt;

&lt;P&gt;So far, so good. &lt;BR /&gt;
Now the strange issue appear.&lt;/P&gt;

&lt;P&gt;sourcetype=senssordata sensortype="sens1" OR sensortype="sens-B" | table *&lt;BR /&gt;
or (sourcetype=senssordata sensortype="sens1" OR sensortype="sens-B" | fieldsummary)&lt;/P&gt;

&lt;P&gt;versus&lt;/P&gt;

&lt;P&gt;sourcetype=senssordata sensortype="sens*" | table *&lt;BR /&gt;
or (sourcetype=senssordata sensortype="sens*" | fieldsummary)&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;These two queries does give a different output!!!&lt;/STRONG&gt;&lt;BR /&gt;
Both field summaries are not equal, and both table * outputs are not equal.&lt;BR /&gt;
Even when both initial data selection has the same events.....&lt;/P&gt;

&lt;P&gt;The outputs of the second query contains much more fields and those fields doesn't seem to exist. &lt;BR /&gt;
This first query seems to output valid date. But the second should do exactly the same.&lt;/P&gt;

&lt;P&gt;Any ideas? &lt;BR /&gt;
Can this be explained or is this a bug?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:45:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Strange-behaviour-with-table/m-p/366694#M108172</guid>
      <dc:creator>FrankSPL</dc:creator>
      <dc:date>2020-09-29T16:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behaviour with | table *</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Strange-behaviour-with-table/m-p/366695#M108173</link>
      <description>&lt;P&gt;are you running &lt;CODE&gt;sourcetype=senssordata sensortype="sens1" OR sensortype="sens-B" | fieldsummary&lt;/CODE&gt; separately and comparing it to &lt;CODE&gt;sourcetype=senssordata sensortype="sens*" | fieldsummary&lt;/CODE&gt; ? I only ask because you shouldn't be able to have a &lt;CODE&gt;|table * or (sourcetype....&lt;/CODE&gt; without the query erroring out. I'm wondering if either part of your query is missing or i'm misunderstanding something.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 12:48:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Strange-behaviour-with-table/m-p/366695#M108173</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-11-14T12:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behaviour with | table *</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Strange-behaviour-with-table/m-p/366696#M108174</link>
      <description>&lt;P&gt;The answer is that, when you are doing &lt;CODE&gt;sensortype=sens*&lt;/CODE&gt;, the system is doing an expansion of all the fields from the other sensortypes before eliminating those sensortypes that don't match.   This leaves a bunch of NULL fields.&lt;/P&gt;

&lt;P&gt;Of course, &lt;CODE&gt;table *&lt;/CODE&gt; is not best practices anyway -- much better to use only the fields that you need for any given query, and to put them in an explicit &lt;CODE&gt;fields&lt;/CODE&gt; command after the first pipe, to minimize the amount of extraction done by the system.  &lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;For an understanding of why this unexpected behavior is not a bug, you have to understand how searches and bloom filters actually work under the covers.  &lt;/P&gt;

&lt;P&gt;If you look at slide 22 of this .conf2017  presentation by MVP Martin Müller (@martin_mueller) at &lt;A href="https://conf.splunk.com/files/2017/slides/fields-indexed-tokens-and-you.pdf"&gt;https://conf.splunk.com/files/2017/slides/fields-indexed-tokens-and-you.pdf&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;...then you will see this wording...&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;▶ Default assumption: Field values are whole indexed tokens &lt;BR /&gt;
▶ &lt;CODE&gt;exception=java.lang.NullPointerException&lt;/CODE&gt; becomes &lt;CODE&gt;[ AND java lang NullPointerException ]&lt;/CODE&gt;&lt;BR /&gt;
▶ Actual field extractions and post-filtering happens after loading raw events&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;So basically, for the event selection, &lt;CODE&gt;sensortype=sens*&lt;/CODE&gt; initially becomes &lt;CODE&gt;AND sens*&lt;/CODE&gt;, so the initial part of the search is going to find all events that have &lt;CODE&gt;sens*&lt;/CODE&gt; somewhere in them.  That is going to literally be every record with a &lt;CODE&gt;sensortype=&lt;/CODE&gt; in its _raw, since &lt;CODE&gt;sens*&lt;/CODE&gt; will pick up the token&lt;CODE&gt;sensortype&lt;/CODE&gt;.  It will also pick up any other fields that happen to have values starting with sens.&lt;/P&gt;

&lt;P&gt;Since you are coding &lt;CODE&gt;| table *&lt;/CODE&gt; , the system cannot optimize to the fields you are asking for and EVERY field has to be expanded.  Once that all gets expanded, the ones where &lt;CODE&gt;sensortype!=sens*&lt;/CODE&gt; get dropped, but the search still knows all the fields that were created/extracted for any of the events.  &lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 13:39:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Strange-behaviour-with-table/m-p/366696#M108174</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-11-14T13:39:16Z</dc:date>
    </item>
  </channel>
</rss>

