<?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: How to extract tracktrace field from one search to use in another search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-tracktrace-field-from-one-search-to-use-in/m-p/141976#M39351</link>
    <description>&lt;P&gt;Revisted this after Xmas and managed to get this working correctly with sub search. There was an issue with my main search string throwing off my results. Thanks for the help&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jan 2015 01:23:56 GMT</pubDate>
    <dc:creator>kenth213</dc:creator>
    <dc:date>2015-01-15T01:23:56Z</dc:date>
    <item>
      <title>How to extract tracktrace field from one search to use in another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-tracktrace-field-from-one-search-to-use-in/m-p/141970#M39345</link>
      <description>&lt;P&gt;I have a dashboard/form which takes two field inputs to perform a search and find an appropriate tracktrace.&lt;BR /&gt;
&lt;CODE&gt;index=myindex sourcetype="mysource" ""$token$"" ""$token2$"" |rex "(?i)(?P[^&amp;lt;]+)" | table tracktrace&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I need to be able to use the tracktrace value from the above search and perform a new search to return a different field which isn't part of the same events returned above e.g.&lt;BR /&gt;
&lt;CODE&gt;index=myindex sourcetype="mysource" $tracktrace$ | rex "(?i)(?P[^&amp;lt;]+)" | table myvalue&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;How would I go about this?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Sep 2014 01:58:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-tracktrace-field-from-one-search-to-use-in/m-p/141970#M39345</guid>
      <dc:creator>kenth213</dc:creator>
      <dc:date>2014-09-26T01:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract tracktrace field from one search to use in another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-tracktrace-field-from-one-search-to-use-in/m-p/141971#M39346</link>
      <description>&lt;P&gt;Have you tried piping it to a search command like so: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex sourcetype="mysource" ""$token$"" ""$token2$"" | rex "(?i)(?P[^&amp;lt;]+)" | search tracktrace | rex "(?i)(?P[^&amp;lt;]+)" | table myvalue
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Sep 2014 03:12:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-tracktrace-field-from-one-search-to-use-in/m-p/141971#M39346</guid>
      <dc:creator>sk314</dc:creator>
      <dc:date>2014-09-26T03:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract tracktrace field from one search to use in another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-tracktrace-field-from-one-search-to-use-in/m-p/141972#M39347</link>
      <description>&lt;P&gt;Yes and it wasn't successful. The information I want to ultimately find/display is in a separate event to where I initially pick up the tracktrace value.&lt;/P&gt;

&lt;P&gt;As the user wouldn't have the tracktrace to return the required results, the purpose of the form is to find the tracktrace for them from information they do have. Then perform a search based off that tracktrace to return the desired information. Some code was trimmed out of my initial post, but basically:&lt;/P&gt;

&lt;P&gt;Search 1 takes two token inputs from text fields and completes the appropriate search to return event that contains the track trace.&lt;BR /&gt;
The track trace value is then extracted.&lt;BR /&gt;
I then need to perform another search with this value to find the event with results they are looking for, and extract/display the field.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Sep 2014 03:50:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-tracktrace-field-from-one-search-to-use-in/m-p/141972#M39347</guid>
      <dc:creator>kenth213</dc:creator>
      <dc:date>2014-09-26T03:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract tracktrace field from one search to use in another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-tracktrace-field-from-one-search-to-use-in/m-p/141973#M39348</link>
      <description>&lt;P&gt;Try this instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex sourcetype="mysource" ""$token$"" ""$token2$"" | rex "(?i)(?P[^&amp;lt;]+)" | search tracktrace ="*" | rex "(?i)(?P[^&amp;lt;]+)" | table myvalue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am assuming token and token2 are populated properly and the rex extraction is named tracktrace. I forgot to add tracktrace="*" in the previous comment.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Sep 2014 07:01:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-tracktrace-field-from-one-search-to-use-in/m-p/141973#M39348</guid>
      <dc:creator>sk314</dc:creator>
      <dc:date>2014-09-26T07:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract tracktrace field from one search to use in another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-tracktrace-field-from-one-search-to-use-in/m-p/141974#M39349</link>
      <description>&lt;P&gt;If I'm understanding what you want to do, it sounds like a subearch might be the way to go.  Something like this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex sourcetype="mysource" [index=myindex sourcetype="mysource" ""$token$"" ""$token2$"" |rex "(?i)(?P[^&amp;lt;]+)" | fields tracktrace | dedup tracktrace] | rex "(?i)(?P[^&amp;lt;]+)" | table myvalue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This approach should work great for retrieving a set of events based on values received from another search, as long as the subsearch returns less than 10,500 results.  If you're going to have more than 10,500 unique tracktraces, we will need to restructure this search.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Sep 2014 12:09:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-tracktrace-field-from-one-search-to-use-in/m-p/141974#M39349</guid>
      <dc:creator>wpreston</dc:creator>
      <dc:date>2014-09-26T12:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract tracktrace field from one search to use in another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-tracktrace-field-from-one-search-to-use-in/m-p/141975#M39350</link>
      <description>&lt;P&gt;This is getting closer thanks! Though I have a couple of bumps that need ironing out.&lt;/P&gt;

&lt;P&gt;Checking the search job inspector, I can see that it has evaluated the subsearch expression and has found the correct value, and incorporated into my main search - perfect. Though I'm returning no results...doh. I think it might be because the field name I am using.&lt;/P&gt;

&lt;P&gt;When I find the track trace initially, it comes from an xml field named , which I was calling tracktrace in my rex. However when I am using that value to find the appropriate logs in my main search the xml field name is .  &lt;/P&gt;

&lt;P&gt;The subsearch then goes looking for tracktrace="M40GW2014092911354947166" which can't be found. &lt;BR /&gt;
Can I somehow still use the value/result (M40GW2014092911354947166) from the subsearch and populate that into the main search in a way that it can find the event &lt;BR /&gt;
i.e. If I just type into search "M40GW2014092911354947166" it would return the correct event.&lt;/P&gt;

&lt;P&gt;Or am I naming the field incorrectly that I could do another way? Currently:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex "(?i)'&amp;lt;'ns2:MessageTrackTrace'&amp;gt;'(?P'&amp;lt;'tracktrace'&amp;gt;'[^&amp;lt;]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;without internal ' ' on arrows.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Sep 2014 01:37:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-tracktrace-field-from-one-search-to-use-in/m-p/141975#M39350</guid>
      <dc:creator>kenth213</dc:creator>
      <dc:date>2014-09-29T01:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract tracktrace field from one search to use in another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-tracktrace-field-from-one-search-to-use-in/m-p/141976#M39351</link>
      <description>&lt;P&gt;Revisted this after Xmas and managed to get this working correctly with sub search. There was an issue with my main search string throwing off my results. Thanks for the help&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jan 2015 01:23:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-tracktrace-field-from-one-search-to-use-in/m-p/141976#M39351</guid>
      <dc:creator>kenth213</dc:creator>
      <dc:date>2015-01-15T01:23:56Z</dc:date>
    </item>
  </channel>
</rss>

