<?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: Why do I get different Search Behavior  depending on fields.conf? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-different-Search-Behavior-depending-on-fields-conf/m-p/11840#M848</link>
    <description>&lt;P&gt;You should not be setting anything in fields.conf for search-time extracted fields. Setting &lt;CODE&gt;INDEXED=true&lt;/CODE&gt; tells Splunk to look for your field as a separately stored and indexed field. It won't be unless it was index-time extracted and stored. (Which, BTW, is rarely recommended.)&lt;/P&gt;

&lt;P&gt;The fact that it works when you add the wildcard is either a bug or a special-casing of wildcard behavior.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Apr 2010 09:56:59 GMT</pubDate>
    <dc:creator>gkanapathy</dc:creator>
    <dc:date>2010-04-21T09:56:59Z</dc:date>
    <item>
      <title>Why do I get different Search Behavior  depending on fields.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-different-Search-Behavior-depending-on-fields-conf/m-p/11838#M846</link>
      <description>&lt;P&gt;I'm running a search based on a field extracted at search time using props.conf.&lt;/P&gt;

&lt;P&gt;I've noticed that if I don't have a fields.conf, my search works fine. Instead if I create a fields.conf and I specify INDEXED=true, I have to add a * at the end of the value I'm searching for.&lt;/P&gt;

&lt;P&gt;An example:&lt;/P&gt;

&lt;P&gt;My props.conf looks like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [myst]

    EXTRACT-dbflds = ^\\[?&amp;lt; locationid&amp;gt;.\*?\] \[?&amp;lt; hostname&amp;gt;.\*?\] \[?&amp;lt; database&amp;gt;.\*?\] \[?&amp;lt; instance&amp;gt;.\*?\] \[?&amp;lt; pid&amp;gt;.\*?\] \[?&amp;lt; thread&amp;gt;.\*?\] \[(.\*?)\]

My source file is like:

    [2010-04-09 17:29:51,085] [asia123] [bighost] [dbprod] [pango] [pid675] [open.connection] 
    [2010-04-09 18:49:52,063] [europe345] [smallhost] [dbdev] [acaia] [pid987] [close.transaction] 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When there is no fields.conf at all, or there is a fields.conf but I with INDEXED=false for every field stanzas, my search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=myst instance=pango
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;works correctly.&lt;/P&gt;

&lt;P&gt;Instead, if there is a fields.conf and I specified INDEXED=true my previous search doesn't return any result, but this does:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=myst instance="pango*"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Why this different behavior?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2010 19:49:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-different-Search-Behavior-depending-on-fields-conf/m-p/11838#M846</guid>
      <dc:creator>mzorzi</dc:creator>
      <dc:date>2010-04-20T19:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I get different Search Behavior  depending on fields.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-different-Search-Behavior-depending-on-fields-conf/m-p/11839#M847</link>
      <description>&lt;P&gt;The setting INDEXED=true for a field, which is not set by default, means that the field was created at indexing time, and is actually stored in a special way in the index (specifically the string instance::pango is indexed.)  Since your fields are created via search-time extractions, this setting is incorrect.  When you ad a wildcard to the value, apparently splunk is abandoning the requirement that it be locatable as an index-time field (though this surprises me).&lt;/P&gt;

&lt;P&gt;In short, this setting is simply not correct for your configuration, which is why it does not work.   Realize that the strings are indexed regardless (INDEXED_VALUE=true) so there isn't really an expected performance cost for this.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2010 01:39:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-different-Search-Behavior-depending-on-fields-conf/m-p/11839#M847</guid>
      <dc:creator>jrodman</dc:creator>
      <dc:date>2010-04-21T01:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I get different Search Behavior  depending on fields.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-different-Search-Behavior-depending-on-fields-conf/m-p/11840#M848</link>
      <description>&lt;P&gt;You should not be setting anything in fields.conf for search-time extracted fields. Setting &lt;CODE&gt;INDEXED=true&lt;/CODE&gt; tells Splunk to look for your field as a separately stored and indexed field. It won't be unless it was index-time extracted and stored. (Which, BTW, is rarely recommended.)&lt;/P&gt;

&lt;P&gt;The fact that it works when you add the wildcard is either a bug or a special-casing of wildcard behavior.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2010 09:56:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-different-Search-Behavior-depending-on-fields-conf/m-p/11840#M848</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-04-21T09:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I get different Search Behavior  depending on fields.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-different-Search-Behavior-depending-on-fields-conf/m-p/11841#M849</link>
      <description>&lt;P&gt;&lt;EM&gt;This is technically more of a comment than an answer (both jrodman and gkanapathy covered the topic well.)  But comments have limited formatting, so I'm posting it here..&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;BTW, it looks like your regex got scrambled when you posted your question.&lt;/P&gt;

&lt;P&gt;With that said, you may want to consider the following regex tweaks:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Drop the trailing un-named group which probably isn't necessary.  (Or give it name if you want it.)&lt;/LI&gt;
&lt;LI&gt;Using non-greedy dot matching is normally a good thing (when compared to simple &lt;CODE&gt;.*&lt;/CODE&gt;), but this can still be costly because of back-tracking within the regex-engine.  Perhaps it would be more efficient to say "stop matching one you find a "]".  As long as you don't have nested square braces, you should be able to match your values using &lt;CODE&gt;[^\]]+&lt;/CODE&gt; rather than &lt;CODE&gt;.*?&lt;/CODE&gt;.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;This should work well for you:
&lt;BR /&gt;
&lt;BR /&gt;
&lt;CODE&gt;EXTRACT-dbflds = ^[^\]]+\] \[(?&amp;lt;locationid&amp;gt;[^\]]+)\] \[(?&amp;lt;hostname&amp;gt;[^\]]+)\] \[(?&amp;lt;database&amp;gt;[^\]]+)\] \[(?&amp;lt;instance&amp;gt;[^\]]+)\] \[(?&amp;lt;pid&amp;gt;[^\]]+)\] \[(?&amp;lt;thread&amp;gt;[^\]]+)\]&lt;/CODE&gt;
&lt;BR /&gt;&lt;/P&gt;

&lt;P&gt;Just some thoughts.  (Hopefully this will actually be formatted correctly when it gets posted...)&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2010 06:10:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-different-Search-Behavior-depending-on-fields-conf/m-p/11841#M849</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-04-22T06:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I get different Search Behavior  depending on fields.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-different-Search-Behavior-depending-on-fields-conf/m-p/11842#M850</link>
      <description>&lt;P&gt;Wow, regex optimization tips.  I've always meant to do some experimentation with timing regex behavior but doing it in a performant enough language to get tight results seemed too boring.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Apr 2010 15:14:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-do-I-get-different-Search-Behavior-depending-on-fields-conf/m-p/11842#M850</guid>
      <dc:creator>jrodman</dc:creator>
      <dc:date>2010-04-23T15:14:49Z</dc:date>
    </item>
  </channel>
</rss>

