<?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: using source for a field extractions in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/using-source-for-a-field-extractions/m-p/78364#M19834</link>
    <description>&lt;P&gt;There is a big difference performance-wise, yes. Doing a second search tells Splunk to actually bring back &lt;EM&gt;all&lt;/EM&gt; the data (in the initial search), then filter it. Specifying it all in the initial search makes use of the full-text index, which means retrieving only the data you specify in the first place. Note that the cost of the initial query is what typically dominates search time. If there a a lot of stuff in the index that does &lt;EM&gt;not&lt;/EM&gt; match the "service", then there will be a significant difference.&lt;/P&gt;</description>
    <pubDate>Mon, 11 Apr 2011 22:49:40 GMT</pubDate>
    <dc:creator>gkanapathy</dc:creator>
    <dc:date>2011-04-11T22:49:40Z</dc:date>
    <item>
      <title>using source for a field extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-source-for-a-field-extractions/m-p/78361#M19831</link>
      <description>&lt;P&gt;I seem to be having some problems with extracting fields from the "source"&lt;/P&gt;

&lt;P&gt;In by props.conf, I have:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_source]
SHOULD_LINEMERGE = false
LINE_BREAKER = (---------*)
REPORT-get_service = get_service
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in transforms.conf, I have:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[get_service]
SOURCE_KEY=source
REGEX = ([^/]*)_sndmsg.out
FORMAT = service::"$1"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This only seems to be half working.
In the search, if I do&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex sourcetype=my_source service=abc
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;nothing comes back.&lt;/P&gt;

&lt;P&gt;If I split it out into a separate search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex sourcetype=my_source | search service=abc
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;then everything works fine.&lt;/P&gt;

&lt;P&gt;Also if I prepend a wildcard, everything works fine, so this also works..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex sourcetype=my_source service=*abc
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If I do an &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval l=len(service)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;it always come back with what I expect.
Everything looks fine when I print out the service field, I just can't put it in the inital search.&lt;/P&gt;

&lt;P&gt;Any ideas would be greatly appreciated.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;-Kevin&lt;/P&gt;</description>
      <pubDate>Sat, 09 Apr 2011 03:30:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-source-for-a-field-extractions/m-p/78361#M19831</guid>
      <dc:creator>kkalmbach</dc:creator>
      <dc:date>2011-04-09T03:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: using source for a field extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-source-for-a-field-extractions/m-p/78362#M19832</link>
      <description>&lt;P&gt;That's because field searches don't look properly at fields that aren't extracted from the raw event text (vs the source field). You can deal with this by setting &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[service]
INDEXED_VALUE=false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in fields.conf. But this is terrible and will make your searches run terribly terribly slow. It will work, but the price is way too high.&lt;/P&gt;

&lt;P&gt;You can also modifying search term from &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;service="abc" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(service="abc" source="*abc*")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is inconvenient. But you could instead define a macro:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[service(1)]
args = sv
definition = ((service="$sv$" source="*$sv$*"))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and invoke it in your search string with:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex myterm1 `service(abc)`
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;instead.&lt;/P&gt;

&lt;P&gt;This is something that should have a prettier solution in Splunk, but that's what we can do today. It would not be bad if you filed an Enhancement Request with Splunk Support to help get this in a future release.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Apr 2011 08:29:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-source-for-a-field-extractions/m-p/78362#M19832</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2011-04-09T08:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: using source for a field extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-source-for-a-field-extractions/m-p/78363#M19833</link>
      <description>&lt;P&gt;I think that makes sense.  Thanks for you answer.&lt;BR /&gt;
I will probably go the macro route.&lt;BR /&gt;
Also, is there a big difference (performance wise)&lt;BR /&gt;
in doing index="..." | search service="abc" &lt;BR /&gt;
compared to putting it all in the same inital search?&lt;BR /&gt;
Thanks again,&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2011 19:40:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-source-for-a-field-extractions/m-p/78363#M19833</guid>
      <dc:creator>kkalmbach</dc:creator>
      <dc:date>2011-04-11T19:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: using source for a field extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-source-for-a-field-extractions/m-p/78364#M19834</link>
      <description>&lt;P&gt;There is a big difference performance-wise, yes. Doing a second search tells Splunk to actually bring back &lt;EM&gt;all&lt;/EM&gt; the data (in the initial search), then filter it. Specifying it all in the initial search makes use of the full-text index, which means retrieving only the data you specify in the first place. Note that the cost of the initial query is what typically dominates search time. If there a a lot of stuff in the index that does &lt;EM&gt;not&lt;/EM&gt; match the "service", then there will be a significant difference.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2011 22:49:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-source-for-a-field-extractions/m-p/78364#M19834</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2011-04-11T22:49:40Z</dc:date>
    </item>
  </channel>
</rss>

