<?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: check if value is in subsearch table result in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311481#M93346</link>
    <description>&lt;P&gt;Hi matansocher,&lt;BR /&gt;
No you can check if the value of the subsearch is in the main search not the opposite.&lt;BR /&gt;
Anyway I see that search and subsearch are the same, what's your need?&lt;BR /&gt;
in addition, you don't need to divide main search, you could use&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=testeda_p groupID=sloc_data project=Periph core=ipa core_ver=* sloc_type="rtl" [ search 
    index=testeda_p groupID=sloc_data project=Periph (core=ipa) core_ver=* sloc_type="rtl" 
    | sort -_time 
    | dedup core_ver 
    | table _time 
     ] 
| table project core core_ver file sloc_date sloc_type sloc upload_id _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Remember that using dedup you have the limit of 10,000 values, to avoid this limit use &lt;CODE&gt;dedup 0&lt;/CODE&gt; .&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Thu, 19 Oct 2017 13:55:56 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2017-10-19T13:55:56Z</dc:date>
    <item>
      <title>check if value is in subsearch table result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311478#M93343</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I need a way to check if a value is in a sub search table result.&lt;BR /&gt;
for example I use the code that doesent work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    index=testeda_p groupID=sloc_data 
    | search project=Periph core=ipa core_ver=* sloc_type="rtl"
    | search _time contains 
        [ search index=testeda_p groupID=sloc_data (project=Periph) (core=ipa) core_ver=* sloc_type="rtl" 
        | sort -_time 
        | dedup core_ver 
        | table _time 
    ] 
    | table project core core_ver file sloc_date sloc_type sloc upload_id _time 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 13:36:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311478#M93343</guid>
      <dc:creator>matansocher</dc:creator>
      <dc:date>2017-10-19T13:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: check if value is in subsearch table result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311479#M93344</link>
      <description>&lt;P&gt;Hi matansocher,&lt;BR /&gt;
did you already tested to run the subsearch?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=testeda_p groupID=sloc_data (project=Periph) (core=ipa) core_ver=* sloc_type="rtl" 
         | sort -_time 
         | dedup core_ver 
         | table _time 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 13:40:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311479#M93344</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-10-19T13:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: check if value is in subsearch table result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311480#M93345</link>
      <description>&lt;P&gt;sure, it returns a table of time (_time field)&lt;BR /&gt;
I will rewrite my question. I need the main search to check if the _time value it (main search) has, is in the table from the sub search. if the subsearch table contains the _time value of the main search&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 13:45:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311480#M93345</guid>
      <dc:creator>matansocher</dc:creator>
      <dc:date>2017-10-19T13:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: check if value is in subsearch table result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311481#M93346</link>
      <description>&lt;P&gt;Hi matansocher,&lt;BR /&gt;
No you can check if the value of the subsearch is in the main search not the opposite.&lt;BR /&gt;
Anyway I see that search and subsearch are the same, what's your need?&lt;BR /&gt;
in addition, you don't need to divide main search, you could use&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=testeda_p groupID=sloc_data project=Periph core=ipa core_ver=* sloc_type="rtl" [ search 
    index=testeda_p groupID=sloc_data project=Periph (core=ipa) core_ver=* sloc_type="rtl" 
    | sort -_time 
    | dedup core_ver 
    | table _time 
     ] 
| table project core core_ver file sloc_date sloc_type sloc upload_id _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Remember that using dedup you have the limit of 10,000 values, to avoid this limit use &lt;CODE&gt;dedup 0&lt;/CODE&gt; .&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 13:55:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311481#M93346</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-10-19T13:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: check if value is in subsearch table result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311482#M93347</link>
      <description>&lt;P&gt;I do realize that my subsearch is pretty much the same as the main search, but i just want to understand the concept of main search field contains the value in a subsearch table result&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 14:11:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311482#M93347</guid>
      <dc:creator>matansocher</dc:creator>
      <dc:date>2017-10-19T14:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: check if value is in subsearch table result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311483#M93348</link>
      <description>&lt;P&gt;Hi matansocher,&lt;BR /&gt;
You have a main search with all the filters you like.&lt;BR /&gt;
One additional filter is the results of the subsearch.&lt;BR /&gt;
Remember that the filter is related to the fields in output of the subsearch, in other words, if I have &lt;CODE&gt;[search index=... | fields name ]&lt;/CODE&gt; , I'm adding an additional filter &lt;CODE&gt;name=all_subsearch_values&lt;/CODE&gt; ; obvioulsy name field must be present in both the searches.&lt;BR /&gt;
If I have in output two fields I have a filter with two fields and so on.&lt;BR /&gt;
This means that I must always choose fields in subsearch output.&lt;/P&gt;

&lt;P&gt;If I want to add a full test search on main search I have to modify my subsearch in &lt;CODE&gt;[search index=... | rename name AS query| fields query ]&lt;/CODE&gt; (query is a fixed fieldname).&lt;/P&gt;

&lt;P&gt;I hope to be exaustive.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 14:33:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311483#M93348</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-10-19T14:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: check if value is in subsearch table result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311484#M93349</link>
      <description>&lt;P&gt;Thank you. that was a great explanation. &lt;BR /&gt;
I am probably doing something wrong.&lt;BR /&gt;
I have that query :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=testeda_p groupID=sloc_data project=Periph core=ipa core_ver=4.2.0 sloc_type="rtl"
[ search index=testeda_p groupID=sloc_data (project=Periph) (core=ipa) core_ver=4.2.0 sloc_type="rtl" 
    | sort -_time 
    | dedup core_ver 
    | table _time
    | fields _time 
] 
| table project core core_ver file sloc_date sloc_type sloc upload_id _time 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;my subsearch creates a table with the field _time?&lt;BR /&gt;
and do I put the subsearch on the right place?&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 15:31:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311484#M93349</guid>
      <dc:creator>matansocher</dc:creator>
      <dc:date>2017-10-19T15:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: check if value is in subsearch table result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311485#M93350</link>
      <description>&lt;P&gt;maybe _time is in a different format between main and sub search&lt;BR /&gt;
try using&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=testeda_p groupID=sloc_data project=Periph core=ipa core_ver=4.2.0 sloc_type="rtl"
| eval _time=strptime(_time,"%Y-%m-%d %H:%M:%S%3N")
 [ search index=testeda_p groupID=sloc_data project=Periph core=ipa core_ver=4.2.0 sloc_type="rtl" 
     | sort -_time 
     | dedup core_ver 
     | eval _time=strptime(_time,"%Y-%m-%d %H:%M:%S%3N")
     | fields _time 
 ] 
 | table project core core_ver file sloc_date sloc_type sloc upload_id _time 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 15:43:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311485#M93350</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-10-19T15:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: check if value is in subsearch table result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311486#M93351</link>
      <description>&lt;P&gt;I have tried that and I get no results. I know it is not correct because I check the data manually. probably something I dont notice. Do you have any other idea of why it does not work?&lt;/P&gt;

&lt;P&gt;Thanks a lot for the effort&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 15:55:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311486#M93351</guid>
      <dc:creator>matansocher</dc:creator>
      <dc:date>2017-10-19T15:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: check if value is in subsearch table result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311487#M93352</link>
      <description>&lt;P&gt;the problem was that by some reason splunk didnt like the manipulation on the _time field. I just added:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval time = _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and then it worked.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 17:05:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/check-if-value-is-in-subsearch-table-result/m-p/311487#M93352</guid>
      <dc:creator>matansocher</dc:creator>
      <dc:date>2017-10-19T17:05:29Z</dc:date>
    </item>
  </channel>
</rss>

