<?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: Creating Indexed Field Extraction from Source -- FORMAT in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195554#M187319</link>
    <description>&lt;P&gt;We have many different services (approaching 100) and the first item our developers would search on is ServiceName.  Nearly every event in this type would have this attribute.&lt;/P&gt;

&lt;P&gt;I have a search based extraction working, but have seen performance issue with broad based searches such as, "ServiceName=TestService"&lt;/P&gt;

&lt;P&gt;I'd like to at least try out the indexed field and test it to see the performance difference.&lt;/P&gt;</description>
    <pubDate>Wed, 19 Mar 2014 21:00:49 GMT</pubDate>
    <dc:creator>Dave98</dc:creator>
    <dc:date>2014-03-19T21:00:49Z</dc:date>
    <item>
      <title>Creating Indexed Field Extraction from Source -- FORMAT</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195552#M187317</link>
      <description>&lt;P&gt;I have been trying to extract an indexed field by using the transforms.conf file. Here's a sample:&lt;/P&gt;

&lt;P&gt;[serviceName]&lt;BR /&gt;&lt;BR /&gt;
SOURCE_KEY = MetaData:Source&lt;BR /&gt;&lt;BR /&gt;
REGEX = ^.{7}\(?P&lt;SERVICENAME&gt;\w+)&lt;BR /&gt;&lt;BR /&gt;
FORMAT = source::ServiceName&lt;BR /&gt;&lt;BR /&gt;
WRITE_META = true  &lt;/SERVICENAME&gt;&lt;/P&gt;

&lt;P&gt;I believe the problem is in the FORMAT = source::ServiceName, but am not sure how to fix it.&lt;/P&gt;

&lt;P&gt;I have tried variants like the following, but none of them work  &lt;/P&gt;

&lt;P&gt;FORMAT = source::$1&lt;BR /&gt;&lt;BR /&gt;
FORMAT = ServiceName::$1&lt;/P&gt;

&lt;P&gt;Can some one help me out with the syntax to extract an indexed field from a SourceKey of source?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:11:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195552#M187317</guid>
      <dc:creator>Dave98</dc:creator>
      <dc:date>2020-09-28T16:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Indexed Field Extraction from Source -- FORMAT</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195553#M187318</link>
      <description>&lt;P&gt;Why do you want an indexed field? A search time field is almost always a better choice...&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 20:14:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195553#M187318</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-03-19T20:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Indexed Field Extraction from Source -- FORMAT</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195554#M187319</link>
      <description>&lt;P&gt;We have many different services (approaching 100) and the first item our developers would search on is ServiceName.  Nearly every event in this type would have this attribute.&lt;/P&gt;

&lt;P&gt;I have a search based extraction working, but have seen performance issue with broad based searches such as, "ServiceName=TestService"&lt;/P&gt;

&lt;P&gt;I'd like to at least try out the indexed field and test it to see the performance difference.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 21:00:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195554#M187319</guid>
      <dc:creator>Dave98</dc:creator>
      <dc:date>2014-03-19T21:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Indexed Field Extraction from Source -- FORMAT</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195555#M187320</link>
      <description>&lt;P&gt;Splunk already indexes every keyword in the data, plus the source sourcetype and host  - so I greatly doubt that you will improve performance in this way.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 21:07:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195555#M187320</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-03-19T21:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Indexed Field Extraction from Source -- FORMAT</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195556#M187321</link>
      <description>&lt;P&gt;If you want the indexed field, you should do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[serviceName]
SOURCE_KEY = MetaData:Source
REGEX = ^.{7}\(w+)
FORMAT = ServiceName::$1
WRITE_META = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The resulting field will be named &lt;CODE&gt;ServiceName&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;[UPDATE]&lt;/EM&gt; You also need to update (or create) &lt;CODE&gt;fields.conf&lt;/CODE&gt; and add the following stanza:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ServiceName]
INDEXED = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Splunk will need to be restarted for these configuration changes to take effect. The indexed field will only appear in new events; if you want the field to appear in existing events, the data will need to be re-indexed.&lt;/P&gt;

&lt;P&gt;Here is a link to the manual topic &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.2/Data/Configureindex-timefieldextraction"&gt;Create custom fields at index time&lt;/A&gt;, complete with  a recommendation &lt;EM&gt;not&lt;/EM&gt; to index fields! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 21:25:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195556#M187321</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-03-19T21:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Indexed Field Extraction from Source -- FORMAT</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195557#M187322</link>
      <description>&lt;P&gt;Well, maybe, but I'd still like to be able to try it out and see for myself.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 21:28:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195557#M187322</guid>
      <dc:creator>Dave98</dc:creator>
      <dc:date>2014-03-19T21:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Indexed Field Extraction from Source -- FORMAT</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195558#M187323</link>
      <description>&lt;P&gt;Ok, I'm going to try this out.  But what happened to the group in the REGEX?  Help me understand why you removed the &lt;BR /&gt;
"?&lt;FIELDID&gt;" syntax.  How will the regex know where to extract the data?&lt;/FIELDID&gt;&lt;/P&gt;

&lt;P&gt;My path is &lt;CODE&gt;d:\logs\ServiceName\logfile.txt&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 21:32:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195558#M187323</guid>
      <dc:creator>Dave98</dc:creator>
      <dc:date>2014-03-19T21:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Indexed Field Extraction from Source -- FORMAT</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195559#M187324</link>
      <description>&lt;P&gt;I changed the REGEX so that still has a capture group, but now it is an &lt;EM&gt;unnamed&lt;/EM&gt; capture group. &lt;CODE&gt;$1&lt;/CODE&gt; refers to the "first capture group", so that's how Splunk knows where to get the info to put into &lt;CODE&gt;serviceName&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Based on your comment, here is a better REGEX; it is more general and looks for the name immediately following the &lt;CODE&gt;\logs\&lt;/CODE&gt; in the path:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;REGEX = \\logs\\(\S+?)\\&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;and yes, you need the double backslashes, because a single backslash has a special meaning in regular expressions.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 22:53:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195559#M187324</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-03-19T22:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Indexed Field Extraction from Source -- FORMAT</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195560#M187325</link>
      <description>&lt;P&gt;I tried your solution, which makes perfect sense.  Unfortunately, it still didn't index.&lt;/P&gt;

&lt;P&gt;I tried to replace the extraction with one coming from _raw, and it worked, so the plumbing is there.&lt;/P&gt;

&lt;P&gt;Any ideas on how to debug or other things to try?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Mar 2014 13:17:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195560#M187325</guid>
      <dc:creator>Dave98</dc:creator>
      <dc:date>2014-03-21T13:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Indexed Field Extraction from Source -- FORMAT</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195561#M187326</link>
      <description>&lt;P&gt;I did a little research and realized that I forgot to mention &lt;CODE&gt;fields.conf&lt;/CODE&gt; - maybe this will work?&lt;/P&gt;</description>
      <pubDate>Sat, 22 Mar 2014 16:46:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-Indexed-Field-Extraction-from-Source-FORMAT/m-p/195561#M187326</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-03-22T16:46:36Z</dc:date>
    </item>
  </channel>
</rss>

