<?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 extracted field as input parameter to another search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-extracted-field-as-input-parameter-to-another-search/m-p/414340#M119378</link>
    <description>&lt;P&gt;Thanks, the output seems way out of order so I removed 'ORGANIZATIONINVENTORY ' field in the table.&lt;BR /&gt;
It is the same output that i desired. Thanks again for your inputs. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
    <pubDate>Wed, 12 Jun 2019 13:58:12 GMT</pubDate>
    <dc:creator>rahulkawadkar26</dc:creator>
    <dc:date>2019-06-12T13:58:12Z</dc:date>
    <item>
      <title>How to use extracted field as input parameter to another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-extracted-field-as-input-parameter-to-another-search/m-p/414336#M119374</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I needed help with using field extracted in the search(ORG) to be used as input for another search where a similar field is present(ORGFROMINVENTORY).&lt;BR /&gt;
If these two fields match mark them as 'OK' and if these fields do not match mark them as 'NOK'.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=teamcity source="ORGINVENTORY") OR (index=jenkins source="ORGINVENTORY")
| rex field=_raw "(?ms)^(?:[^;\n]*;){6}(?P&amp;lt;ORGANIZATIONINVENTORY &amp;gt;[^;]+)" offset_field=_extracted_fields_bounds
| dedup ORGANIZATIONINVENTORY 
| append [ search (index=* OR index=_) index=teamcity sourcetype="teamcity:vcs" jetbrains.buildServer.VCS 
| rex field=_raw "(?ms)^(?:[^\"\\n]\"){3}(?P&amp;lt;vcsRoot&amp;gt;[^\"]+)" offset_field=_extracted_fields_bounds 
| search vcsRoot=*git* 
| dedup vcsRoot 
| eval connectionType = case(like(vcsRoot, "git@%"),"ssh", like(vcsRoot, "http%"),"https") 
| eval customSSH=case(connectionType=="ssh",'vcsRoot') ,customHTTP=case(connectionType=="https",'vcsRoot')
| makemv delim="/" customHTTP 
| makemv delim=":" customSSH 
| eval customSSH=mvindex(customSSH,1) 
| makemv delim="/" customSSH 
| eval ORG=case(connectionType=="https",mvindex(customHTTP,2),connectionType=="ssh",mvindex(customSSH,0))
| dedup ORG
] | eval suspicious = if(match(ORGANIZATIONINVENTORY ,ORG), "No", "Yes")
| table ORG, ORGANIZATIONINVENTORY , suspicious
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm unable to match the field extracted in first query(ORG) with the field in second query(ORGFROMINVENTORY). Is there any function that I can make use of?&lt;BR /&gt;
Is there any way I can pass the field extracted in first query to lookup for a similar value in second search?&lt;BR /&gt;
I can't seem to get ORGFROMINVENTORY in my search result.&lt;/P&gt;

&lt;P&gt;Can you point out the mistake i'm making. I'm getting ORGANIZATIONINVENTORY value null in my search result&lt;/P&gt;

&lt;P&gt;ORG ORGANIZATIONINVENTORY   suspicious&lt;BR /&gt;
            ORG1            Yes&lt;BR /&gt;
           ORG2         Yes&lt;BR /&gt;
           ORG3         Yes&lt;BR /&gt;
           ORG4         Yes&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 11:03:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-extracted-field-as-input-parameter-to-another-search/m-p/414336#M119374</guid>
      <dc:creator>rahulkawadkar26</dc:creator>
      <dc:date>2019-06-12T11:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to use extracted field as input parameter to another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-extracted-field-as-input-parameter-to-another-search/m-p/414337#M119375</link>
      <description>&lt;P&gt;Can you please update your answer with the correct search query posted as code. I tried fixing it, but seems some of your code contains characters like &lt;CODE&gt;&amp;lt;&amp;gt;&lt;/CODE&gt; which get filtered if you don't post them as code.&lt;/P&gt;

&lt;P&gt;Overall this approach cannot work. You can't just take 2 lists and compare them side-by-side like this, you will need some common field to link the related rows from the 2 lists together. Without such a linking pin, the best you could do is see if the values from one result occur in the other. Is that what you want?&lt;/P&gt;

&lt;P&gt;There are also various issues with your search when looking at the details:&lt;BR /&gt;
&lt;CODE&gt;| stats list(ORG) as "Organizations extracted from TeamCity"&lt;/CODE&gt; returns a single (multivalued) row.&lt;BR /&gt;
You then append a bunch of additional rows from the 'inventory', but those are on separate rows, so that will not allow comparison.&lt;BR /&gt;
Also: the field names in your eval do not match what your fields are actually called.&lt;/P&gt;

&lt;P&gt;But before we go into fixing it, please clarify what exactly you want to achieve and please update your question with the correct search code.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 12:27:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-extracted-field-as-input-parameter-to-another-search/m-p/414337#M119375</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-06-12T12:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to use extracted field as input parameter to another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-extracted-field-as-input-parameter-to-another-search/m-p/414338#M119376</link>
      <description>&lt;P&gt;I want to get each value from ORGINVENTORY extracted in first search and validate it against results obtained from second search query where i'm deriving a similar value(ORG). If they match flag them as OK and if they do not match flag them as NOK.&lt;BR /&gt;
I could do with verifying if one result occur in another.&lt;BR /&gt;
Also, I'd like to know about this 'linking-pin' suggestion, any pointers on how it can be achieved?&lt;/P&gt;

&lt;P&gt;Any sort of suggestion is welcome, I'm fairly new to splunk and do understand, my approach may not be the best.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 12:43:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-extracted-field-as-input-parameter-to-another-search/m-p/414338#M119376</guid>
      <dc:creator>rahulkawadkar26</dc:creator>
      <dc:date>2019-06-12T12:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to use extracted field as input parameter to another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-extracted-field-as-input-parameter-to-another-search/m-p/414339#M119377</link>
      <description>&lt;P&gt;Assuming your search code is correct (apart from the actual matching you were trying to do), I think the following should work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=teamcity source="ORGINVENTORY") OR (index=jenkins source="ORGINVENTORY")
 | rex field=_raw "(?ms)^(?:[^;\n]*;){6}(?P&amp;lt;ORGANIZATIONINVENTORY &amp;gt;[^;]+)" offset_field=_extracted_fields_bounds
 | dedup ORGANIZATIONINVENTORY 
 | append [ search (index=* OR index=_) index=teamcity sourcetype="teamcity:vcs" jetbrains.buildServer.VCS 
 | rex field=_raw "(?ms)^(?:[^\"\\n]\"){3}(?P&amp;lt;vcsRoot&amp;gt;[^\"]+)" offset_field=_extracted_fields_bounds 
 | search vcsRoot=*git* 
 | dedup vcsRoot 
 | eval connectionType = case(like(vcsRoot, "git@%"),"ssh", like(vcsRoot, "http%"),"https") 
 | eval customSSH=case(connectionType=="ssh",'vcsRoot') ,customHTTP=case(connectionType=="https",'vcsRoot')
 | makemv delim="/" customHTTP 
 | makemv delim=":" customSSH 
 | eval customSSH=mvindex(customSSH,1) 
 | makemv delim="/" customSSH 
 | eval ORG=case(connectionType=="https",mvindex(customHTTP,2),connectionType=="ssh",mvindex(customSSH,0))
 | dedup ORG
 ] 
 | eventstats values(ORGANIZATIONINVENTORY) as ORGANIZATIONINVENTORY
 | search ORG=*
 | eval suspicious = if(ORG=ORGANIZATIONINVENTORY, "No", "Yes")
 | table ORG, ORGANIZATIONINVENTORY , suspicious
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;After the base search and &lt;CODE&gt;append []&lt;/CODE&gt; part I copied from your search, you basically have rows with ORGANIZATIONINVENTORY field, followed by rows with ORG field. (try running only that part of the search to see for yourself).&lt;BR /&gt;
Then with &lt;CODE&gt;eventstats values(ORGANIZATIONINVENTORY) as ORGANIZATIONINVENTORY&lt;/CODE&gt; I add a multivalued list of all occuring ORGANIZATIONINVENTORY field values to &lt;STRONG&gt;each&lt;/STRONG&gt; row.&lt;BR /&gt;
Then I search for only the rows with ORG field, as those are the rows which you want to check against the list in ORGANIZATIONINVENTORY.&lt;BR /&gt;
Then do the eval. No need to use match(), just an &lt;CODE&gt;=&lt;/CODE&gt; comparison of the ORG value against the multivalued ORGANIZATIONINVENTORY field will work.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 13:14:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-extracted-field-as-input-parameter-to-another-search/m-p/414339#M119377</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-06-12T13:14:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to use extracted field as input parameter to another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-extracted-field-as-input-parameter-to-another-search/m-p/414340#M119378</link>
      <description>&lt;P&gt;Thanks, the output seems way out of order so I removed 'ORGANIZATIONINVENTORY ' field in the table.&lt;BR /&gt;
It is the same output that i desired. Thanks again for your inputs. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 13:58:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-extracted-field-as-input-parameter-to-another-search/m-p/414340#M119378</guid>
      <dc:creator>rahulkawadkar26</dc:creator>
      <dc:date>2019-06-12T13:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use extracted field as input parameter to another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-extracted-field-as-input-parameter-to-another-search/m-p/414341#M119379</link>
      <description>&lt;P&gt;Yeah, as mentioned that field contains the full list of values to check against, so probably indeed better to not include that in the output &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 14:08:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-extracted-field-as-input-parameter-to-another-search/m-p/414341#M119379</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-06-12T14:08:33Z</dc:date>
    </item>
  </channel>
</rss>

