<?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 use rex extracted field value in another search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-extracted-field-value-in-another-search/m-p/451814#M127938</link>
    <description>&lt;P&gt;First implement these field extractions to be automatically done, instead of relying on rex.&lt;/P&gt;

&lt;P&gt;Then you can do:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="secondarydata" app="payments-service" [search index="trans" source="logfilename" "ErrorCode=81009" requestid = "*ABC*" | table UID]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The subsearch will run first and will result in &lt;CODE&gt;(UID="abc" OR UID="def" OR ...)&lt;/CODE&gt; that is embedded in the outer search.&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jun 2019 07:55:36 GMT</pubDate>
    <dc:creator>FrankVl</dc:creator>
    <dc:date>2019-06-28T07:55:36Z</dc:date>
    <item>
      <title>How to use rex extracted field value in another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-extracted-field-value-in-another-search/m-p/451812#M127936</link>
      <description>&lt;P&gt;I have a search like the following:&lt;BR /&gt;
&lt;CODE&gt;index="trans" source="logfilename" "ErrorCode=81009" requestid = "*ABC*"&lt;BR /&gt;
| rex field=requestid "-(?.*)$"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This search finds me instances of the 81009 error and then extracts a UID from the request ID (request IDs look like &lt;CODE&gt;abc3232-ABC123ab45&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;I would then like to take the values extracted, now stored in the UID field and perform a whole different search:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index="secondarydata" app="payments-service"&lt;BR /&gt;
| rex field=breadcrumb "-(?.*)$"&lt;/CODE&gt;&lt;BR /&gt;
&lt;EM&gt;(then something like the below)&lt;/EM&gt;&lt;BR /&gt;
&lt;CODE&gt;| where UID = UID2&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I am trying to take the UID from the first search and find data from a second search that also has that UID present.&lt;/P&gt;

&lt;P&gt;I am not aquainted enough with join/subsearch and such but I assume I need to use something like that...&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 07:19:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-extracted-field-value-in-another-search/m-p/451812#M127936</guid>
      <dc:creator>gcharles</dc:creator>
      <dc:date>2019-06-28T07:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use rex extracted field value in another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-extracted-field-value-in-another-search/m-p/451813#M127937</link>
      <description>&lt;P&gt;Hi gcharles,&lt;BR /&gt;
You can extract the field using the Field Extractor or, having the regex, create a new field in the Fileds section.&lt;BR /&gt;
Then you have two choices:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;if you have to use it only in the same App, shate the field att App level,&lt;/LI&gt;
&lt;LI&gt;if you have to use it also in other Apps, shate the field att Global level.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;You have to connect the field to a sourcetyoe, check if the regex extract always the correct values.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 07:40:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-extracted-field-value-in-another-search/m-p/451813#M127937</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-06-28T07:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to use rex extracted field value in another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-extracted-field-value-in-another-search/m-p/451814#M127938</link>
      <description>&lt;P&gt;First implement these field extractions to be automatically done, instead of relying on rex.&lt;/P&gt;

&lt;P&gt;Then you can do:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="secondarydata" app="payments-service" [search index="trans" source="logfilename" "ErrorCode=81009" requestid = "*ABC*" | table UID]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The subsearch will run first and will result in &lt;CODE&gt;(UID="abc" OR UID="def" OR ...)&lt;/CODE&gt; that is embedded in the outer search.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 07:55:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-extracted-field-value-in-another-search/m-p/451814#M127938</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-06-28T07:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to use rex extracted field value in another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-extracted-field-value-in-another-search/m-p/451815#M127939</link>
      <description>&lt;P&gt;Sorry, can you explain more because it has not helped.&lt;/P&gt;

&lt;P&gt;I can see that the subsearch will result in a table like the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;UID
---------
ABC45678
23536352
asfsdfdef434
etc...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But how am I to then try and find events in the &lt;CODE&gt;secondarydata&lt;/CODE&gt; index using anyone of the results in the table?&lt;/P&gt;

&lt;P&gt;For instance (not worrying about field extract at the moment):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=secondarydata app="payments-service" 
    [search index="trans" sourcetype=kvp" "ErrorCode=81009" requestid=*AU* 
    |  table requestid] camel.breadcrumbId = requestid
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I just want to see the log events from the &lt;CODE&gt;secondarydata&lt;/CODE&gt; index in the search results that have the same requestid's that were found in the subsearch.&lt;/P&gt;

&lt;P&gt;Further, I would also like to do a wildcard match using the UID/requestid where the end of the search might be:&lt;BR /&gt;
&lt;CODE&gt;camel.breadcrumbId = *requestid*&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 00:20:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-extracted-field-value-in-another-search/m-p/451815#M127939</guid>
      <dc:creator>gcharles</dc:creator>
      <dc:date>2019-07-01T00:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to use rex extracted field value in another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-extracted-field-value-in-another-search/m-p/451816#M127940</link>
      <description>&lt;P&gt;"not worrying about field extract"&lt;/P&gt;

&lt;P&gt;As I mentioned: you need to have the UID field extracted properly (automatically, not with &lt;CODE&gt;rex&lt;/CODE&gt;) before this solution can work.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 07:36:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-rex-extracted-field-value-in-another-search/m-p/451816#M127940</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-07-01T07:36:37Z</dc:date>
    </item>
  </channel>
</rss>

