<?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: Trying to Find All Names that Match a Name in a Field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-Find-All-Names-that-Match-a-Name-in-a-Field/m-p/660772#M228139</link>
    <description>&lt;P&gt;I get a rough idea about what the OP wants:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The lowest level domain in DNS must be that in Identified_Host + "-admin" or "-mgt", and&lt;/LI&gt;&lt;LI&gt;All upper level domains in DNS and those in Identified_Host are identical.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;If this is correct, here is a literal interpretation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| foreach DNS Identified_Host
    [rex field=&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; "(?&amp;lt;&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;_low&amp;gt;[^\.]+).(?&amp;lt;&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;_up&amp;gt;.+)"]
| where match(DNS_low, "^". Identified_Host_low. "-(admin|mgt)$") AND DNS_up == Identified_Host_up
| fields - *_low *_up&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pro tip: You can do volunteers here a great favor if you not just describe the data, but also demonstrate what is desired result, then explain the logic between data and desired result.&lt;/P&gt;&lt;P&gt;Using the data emulation&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/158935"&gt;@yeahnah&lt;/a&gt;&amp;nbsp;gives, the result from this search is&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;DNS&lt;/TD&gt;&lt;TD&gt;Identified_Host&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;host1-admin.domain.com&lt;/TD&gt;&lt;TD&gt;host1.domain.com&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;host1-mgt.domain.com&lt;/TD&gt;&lt;TD&gt;host1.domain.com&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Are these what you expect?&lt;/P&gt;</description>
    <pubDate>Sat, 14 Oct 2023 08:37:06 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2023-10-14T08:37:06Z</dc:date>
    <item>
      <title>Trying to Find All Names that Match a Name in a Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-Find-All-Names-that-Match-a-Name-in-a-Field/m-p/660543#M228050</link>
      <description>&lt;P&gt;I have a field called DNS whos field values contain the hostname in the lookup. There is also another field called Identified_Host that has similar values. I will show the difference below:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE border="1" width="45.41876995982281%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="41.85606060606061%" height="25px"&gt;DNS&lt;/TD&gt;&lt;TD width="24.810606060606066%" height="25px"&gt;Identified_Host&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="41.85606060606061%" height="25px"&gt;host1.domain.com&lt;/TD&gt;&lt;TD width="24.810606060606066%" height="25px"&gt;host1.domain.com&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="41.85606060606061%" height="25px"&gt;host1-admin.domain.com&lt;/TD&gt;&lt;TD width="24.810606060606066%" height="25px"&gt;host1.domain.com&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="41.85606060606061%" height="25px"&gt;host1-mgt.domain.com&lt;/TD&gt;&lt;TD width="24.810606060606066%" height="25px"&gt;host1.domain.com&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="41.85606060606061%" height="25px"&gt;host2.domain.com&lt;/TD&gt;&lt;TD width="24.810606060606066%" height="25px"&gt;host2.domain.com&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="41.85606060606061%" height="25px"&gt;host2-admin.com&lt;/TD&gt;&lt;TD width="24.810606060606066%" height="25px"&gt;host2.domain.com&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="41.85606060606061%" height="25px"&gt;host2-mgt.admin.com&lt;/TD&gt;&lt;TD width="24.810606060606066%" height="25px"&gt;host2.domain.com&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="41.85606060606061%" height="25px"&gt;host3.domain.com&lt;/TD&gt;&lt;TD width="24.810606060606066%" height="25px"&gt;host3.domain.com&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="41.85606060606061%" height="25px"&gt;host3-admin.com&lt;/TD&gt;&lt;TD width="24.810606060606066%" height="25px"&gt;host3.domain.com&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From this example. it's shown that Indetified_Host is the main name of the host. I need to find out which hosts in Identified_Hosts have values in DNS with the same name but also end with -admin and/or -mgt.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 15:28:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-Find-All-Names-that-Match-a-Name-in-a-Field/m-p/660543#M228050</guid>
      <dc:creator>atebysandwich</dc:creator>
      <dc:date>2023-10-12T15:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Find All Names that Match a Name in a Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-Find-All-Names-that-Match-a-Name-in-a-Field/m-p/660592#M228081</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/253260"&gt;@atebysandwich&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I'm not 100% sure I understand what you are trying to do but does this run anywhere example help...&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="DNS,Identified_Host
host1.domain.com,host1.domain.com
host1-admin.domain.com,host1.domain.com
host1-mgt.domain.com,host1.domain.com
host2.domain.com,host2.domain.com
host2-admin.com,host2.domain.com
host2-mgt.admin.com,host2.domain.com
host3.domain.com,host3.domain.com
host3-admin.com,host3.domain.com"
| multikv forceheader=1
| table DNS Identified_Host
 ```^^^ dummy events ^^^```
| where DNS!=Identified_Host
| stats values(DNS) BY Identified_Host&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 22:11:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-Find-All-Names-that-Match-a-Name-in-a-Field/m-p/660592#M228081</guid>
      <dc:creator>yeahnah</dc:creator>
      <dc:date>2023-10-12T22:11:07Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Find All Names that Match a Name in a Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-Find-All-Names-that-Match-a-Name-in-a-Field/m-p/660772#M228139</link>
      <description>&lt;P&gt;I get a rough idea about what the OP wants:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The lowest level domain in DNS must be that in Identified_Host + "-admin" or "-mgt", and&lt;/LI&gt;&lt;LI&gt;All upper level domains in DNS and those in Identified_Host are identical.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;If this is correct, here is a literal interpretation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| foreach DNS Identified_Host
    [rex field=&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; "(?&amp;lt;&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;_low&amp;gt;[^\.]+).(?&amp;lt;&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;_up&amp;gt;.+)"]
| where match(DNS_low, "^". Identified_Host_low. "-(admin|mgt)$") AND DNS_up == Identified_Host_up
| fields - *_low *_up&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pro tip: You can do volunteers here a great favor if you not just describe the data, but also demonstrate what is desired result, then explain the logic between data and desired result.&lt;/P&gt;&lt;P&gt;Using the data emulation&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/158935"&gt;@yeahnah&lt;/a&gt;&amp;nbsp;gives, the result from this search is&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;DNS&lt;/TD&gt;&lt;TD&gt;Identified_Host&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;host1-admin.domain.com&lt;/TD&gt;&lt;TD&gt;host1.domain.com&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;host1-mgt.domain.com&lt;/TD&gt;&lt;TD&gt;host1.domain.com&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Are these what you expect?&lt;/P&gt;</description>
      <pubDate>Sat, 14 Oct 2023 08:37:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-Find-All-Names-that-Match-a-Name-in-a-Field/m-p/660772#M228139</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-10-14T08:37:06Z</dc:date>
    </item>
  </channel>
</rss>

