<?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 values exist within two columns in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371782#M109398</link>
    <description>&lt;P&gt;Yes, the eval command is applied to each event independently. So you are checking the fields within events, not between events.&lt;/P&gt;

&lt;P&gt;If you explain your problem a bit more, the community might be able to help with a solution. What was the complete search that got you to this point?&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jan 2018 19:24:28 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2018-01-03T19:24:28Z</dc:date>
    <item>
      <title>Check values exist within two columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371780#M109396</link>
      <description>&lt;P&gt;I tried to apply this logic as I want to check if the values from con_splunkUL exists within con_UL, but for me it seems its checking for a direct match between both fields rather than checking for a match within the whole data set.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval MonitoringStatus = if(like(con_splunkUL,"%".con_UL."%"), "Monitored", "Not Monitored") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/225640-capture.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:28:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371780#M109396</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2020-09-29T17:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: Check values exist within two columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371781#M109397</link>
      <description>&lt;P&gt;If you want to compare the components of the strings prior to the comma, that should be fairly easy.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=con_splunkUL "(?&amp;lt;con_splunkUL_pre&amp;gt;[^,]+)," 
| rex field=con_UL "(?&amp;lt;con_UL_pre&amp;gt;[^,]+)," 
| eval MonitoringStatus=if(con_splunkUL_pre=con_UL_pre, "Monitored", "Not Monitored")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jan 2018 18:52:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371781#M109397</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-03T18:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: Check values exist within two columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371782#M109398</link>
      <description>&lt;P&gt;Yes, the eval command is applied to each event independently. So you are checking the fields within events, not between events.&lt;/P&gt;

&lt;P&gt;If you explain your problem a bit more, the community might be able to help with a solution. What was the complete search that got you to this point?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 19:24:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371782#M109398</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2018-01-03T19:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: Check values exist within two columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371783#M109399</link>
      <description>&lt;P&gt;So for further context both fields contain concatenations of the FileServer + Drive so that I can easily compare if there are any matches. For each File Server there may be more than 1 drive being monitored.&lt;/P&gt;

&lt;P&gt;I added a stats value to store all possible values contained within con_UL to see if any con_splunkUL values  exists within con_UL but it still does not work as I think its comparing the full value of con_UL&lt;/P&gt;

&lt;P&gt;Below is the full query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=windows host=*nas* source=WMI:Shares 
| eval machine=lower(host) 
| eval drive = Path 
| rex field=drive "(?P&amp;lt;Drive&amp;gt;\w+)\:" 
| eval con_splunk=machine. "," .Drive 
| eval con_splunkUL = upper(con_splunk) 
| join type=left machine 
    [ search source="otl_varonis_monitoring.csv" host="opspksh01d.options-it.com" sourcetype="csv" type=Production 
    | eval con=machine. "," .drive 
    | eval con_UL = upper(con) 
    | stats values(con_UL) as con_UL by machine] 
| eval MonitoringStatus = if(like(con_splunkUL,"%".con_UL."%"), "Monitored", "Not Monitored") 
| dedup machine, Path, MonitoringStatus 
| table machine, Path, MonitoringStatus, type , con_splunkUL, con_UL 
| sort +str(type), machine
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sample output: OPNAS02E,E OPNAS02E,F OPNAS02E,G&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:28:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371783#M109399</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2020-09-29T17:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: Check values exist within two columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371784#M109400</link>
      <description>&lt;P&gt;Thank you but I want to basically use con_UL as a lookup containing all values that I want to check against. I added more information below. &lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 19:49:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371784#M109400</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2018-01-03T19:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: Check values exist within two columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371785#M109401</link>
      <description>&lt;P&gt;The requested information is below. &lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 19:50:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371785#M109401</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2018-01-03T19:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: Check values exist within two columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371786#M109402</link>
      <description>&lt;P&gt;I think you could accomplish this more easily without concatenating the drive and machine name, and without the join.&lt;/P&gt;

&lt;P&gt;Consider something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=windows host=*nas* source=WMI:Shares) OR (source="otl_varonis_monitoring.csv" host="opspksh01d.options-it.com" sourcetype="csv" type=Production)
| eval machine=if(source="WMI:Shares", lower(host), machine)
| eval drive=if(source="WMI:Shares", Path, drive)
| stats values(source) AS sources BY machine drive
| eval MonitoringStatus=if(match(sources, "otl_varonis_monitoring.csv"), "Monitored", "Not Monitored")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As a run anywhere example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval host="host1", Path="a", source="WMI:Shares"
| append [|makeresults | eval host="host1", Path="b", source="WMI:Shares"]
| append [|makeresults | eval host="host1", Path="c", source="WMI:Shares"]
| append [|makeresults | eval host="host2", Path="a", source="WMI:Shares"]
| append [|makeresults | eval machine="host1", drive="a", source="otl_varonis_monitoring.csv"]
| append [|makeresults | eval machine="host1", drive="b", source="otl_varonis_monitoring.csv"]
| append [|makeresults | eval machine="host2", drive="a", source="otl_varonis_monitoring.csv"]
| eval machine=if(source="WMI:Shares", lower(host), machine)
| eval drive=if(source="WMI:Shares", Path, drive)
| stats values(source) AS sources BY machine drive
| eval MonitoringStatus=if(match(sources, "otl_varonis_monitoring.csv"), "Monitored", "Not Monitored")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jan 2018 21:11:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371786#M109402</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-03T21:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: Check values exist within two columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371787#M109403</link>
      <description>&lt;P&gt;Yeah that makes sense thanks&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 21:52:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371787#M109403</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2018-01-03T21:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Check values exist within two columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371788#M109404</link>
      <description>&lt;P&gt;If you have tested this method and it works, please accept the answer so that others may more quickly find the solution.&lt;/P&gt;

&lt;P&gt;If not, please disregard this comment. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 02:57:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Check-values-exist-within-two-columns/m-p/371788#M109404</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-04T02:57:44Z</dc:date>
    </item>
  </channel>
</rss>

