<?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: Find values of Field 1 in Field 2 in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Find-values-of-Field-1-in-Field-2/m-p/745894#M241569</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/276516"&gt;@k1green97&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check out the following, if your Field2 is a multivalue field you should be good with a 'where IN':&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where Field1 IN (Field2)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Full example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| windbag | head 25 | streamstats count as Field1
| table _time Field1
| eval  Field2=split("27,33,17,22,24,31,29,08,36",",")
| where Field1 IN (Field2)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HOWEVER, if as it looks on the table you posted that for Row 1, Field1=17 Field2=27 but you want to check if Field1 is in the combined list of Field2 values then you will need to group them together first using eventstats:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eventstats values(Field2) as Field2
| where Field1 IN (Field2)&lt;/LI-CODE&gt;&lt;P&gt;Full example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=9 | streamstats count as _n
| eval Field1=case(_n=1, 17, _n=2, 24, _n=3, 36)
| eval Field2=case(_n=1, 27, _n=2, 33, _n=3, 17, _n=4, 22, _n=5, 24, _n=6, 31, _n=7, 29, _n=8, 8, _n=9, 36)
| fields - _time
``` finished data sample ```
| eventstats values(Field2) as Field2
| where Field1 IN (Field2)&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="livehybrid_0-1746890032973.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/38931i55E6EB5F4E91A3C7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="livehybrid_0-1746890032973.png" alt="livehybrid_0-1746890032973.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding karma to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;</description>
    <pubDate>Sat, 10 May 2025 15:14:02 GMT</pubDate>
    <dc:creator>livehybrid</dc:creator>
    <dc:date>2025-05-10T15:14:02Z</dc:date>
    <item>
      <title>Find values of Field 1 in Field 2</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-values-of-Field-1-in-Field-2/m-p/745880#M241565</link>
      <description>&lt;P&gt;I am not sure where to start on this. I have 2 fields. Field1 only has a few values while Field2 has many. How can I return values Field2 that appear in Field1?&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%" height="24px"&gt;Field 1&lt;/TD&gt;&lt;TD width="50%" height="24px"&gt;Field 2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="24px"&gt;17&lt;/TD&gt;&lt;TD width="50%" height="24px"&gt;27&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="24px"&gt;24&lt;/TD&gt;&lt;TD width="50%" height="24px"&gt;33&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="24px"&gt;36&lt;/TD&gt;&lt;TD width="50%" height="24px"&gt;17&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="50%" height="24px"&gt;22&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="50%" height="24px"&gt;24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="50%" height="24px"&gt;31&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="50%" height="24px"&gt;29&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="50%" height="24px"&gt;08&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="50%" height="24px"&gt;&lt;P&gt;36&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sat, 10 May 2025 02:04:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-values-of-Field-1-in-Field-2/m-p/745880#M241565</guid>
      <dc:creator>k1green97</dc:creator>
      <dc:date>2025-05-10T02:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Find values of Field 1 in Field 2</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-values-of-Field-1-in-Field-2/m-p/745882#M241566</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/276516"&gt;@k1green97&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;To find values of Field1 that appear in Field2 using Splunk with &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;makeresults(&lt;SPAN&gt;The &lt;STRONG&gt;makeresults&lt;/STRONG&gt; command&lt;/SPAN&gt;&lt;SPAN&gt; allows users to quickly generate sample data sets for testing)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp;you can create a query that generates the data and then uses &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;eval&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt; and &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;where&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt; to filter the matching values.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kiran_panchavat_0-1746853037991.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/38929i3F7C533F060077B3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kiran_panchavat_0-1746853037991.png" alt="kiran_panchavat_0-1746853037991.png" /&gt;&lt;/span&gt;&lt;P&gt;You can try this query and replace the values:&lt;/P&gt;&lt;PRE&gt;index=my_index sourcetype=my_sourcetype 
| stats values(Field1) as Field1_values, values(Field2) as Field2_values 
| mvexpand Field1_values 
| where Field1_values IN (Field2_values) 
| table Field1_values&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 10 May 2025 05:14:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-values-of-Field-1-in-Field-2/m-p/745882#M241566</guid>
      <dc:creator>kiran_panchavat</dc:creator>
      <dc:date>2025-05-10T05:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: Find values of Field 1 in Field 2</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-values-of-Field-1-in-Field-2/m-p/745884#M241567</link>
      <description>&lt;P&gt;OK. And those "fields" are...? Values of a multivalued field in a single event? Or just multiple values returned from "stats values "command? Something else?&lt;/P&gt;&lt;P&gt;Do you have any other fields in your data? Do you want them preserved?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 May 2025 07:39:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-values-of-Field-1-in-Field-2/m-p/745884#M241567</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2025-05-10T07:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: Find values of Field 1 in Field 2</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-values-of-Field-1-in-Field-2/m-p/745894#M241569</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/276516"&gt;@k1green97&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check out the following, if your Field2 is a multivalue field you should be good with a 'where IN':&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where Field1 IN (Field2)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Full example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| windbag | head 25 | streamstats count as Field1
| table _time Field1
| eval  Field2=split("27,33,17,22,24,31,29,08,36",",")
| where Field1 IN (Field2)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HOWEVER, if as it looks on the table you posted that for Row 1, Field1=17 Field2=27 but you want to check if Field1 is in the combined list of Field2 values then you will need to group them together first using eventstats:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eventstats values(Field2) as Field2
| where Field1 IN (Field2)&lt;/LI-CODE&gt;&lt;P&gt;Full example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=9 | streamstats count as _n
| eval Field1=case(_n=1, 17, _n=2, 24, _n=3, 36)
| eval Field2=case(_n=1, 27, _n=2, 33, _n=3, 17, _n=4, 22, _n=5, 24, _n=6, 31, _n=7, 29, _n=8, 8, _n=9, 36)
| fields - _time
``` finished data sample ```
| eventstats values(Field2) as Field2
| where Field1 IN (Field2)&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="livehybrid_0-1746890032973.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/38931i55E6EB5F4E91A3C7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="livehybrid_0-1746890032973.png" alt="livehybrid_0-1746890032973.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding karma to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;</description>
      <pubDate>Sat, 10 May 2025 15:14:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-values-of-Field-1-in-Field-2/m-p/745894#M241569</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-05-10T15:14:02Z</dc:date>
    </item>
  </channel>
</rss>

