<?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 remove wild cards/suffix values from values of hostname? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-wild-cards-suffix-values-from-values-of-hostname/m-p/654276#M226080</link>
    <description>&lt;LI-CODE lang="markup"&gt;| rex field=vm_name "^#*(?&amp;lt;real_vm_name&amp;gt;[a-z0-9]+)"&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 14 Aug 2023 12:26:21 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2023-08-14T12:26:21Z</dc:date>
    <item>
      <title>How to remove wild cards/suffix values from values of hostname?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-wild-cards-suffix-values-from-values-of-hostname/m-p/653789#M225948</link>
      <description>&lt;P&gt;below is my search query&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="inm_inventory"
|table inventory_date, region, vm_name, version
|dedup vm_name | search vm_name="*old*" OR vm_name="*restore*"&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;output as below :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="srv007_1-1691604249760.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/26715iB04597A9B9F90A00/image-size/medium?v=v2&amp;amp;px=400" role="button" title="srv007_1-1691604249760.png" alt="srv007_1-1691604249760.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The challenge here is each vm_name has different suffix added and its not standard since any user adds any comment to to it so it could be anything. how do i perform look for the vm names since lookup file only has hostnames and no suffix.&lt;BR /&gt;&lt;BR /&gt;i have a lookup file named itso.csv which has details like hostname(all in lower case), tier, owner, country. I want to use lookup in my main search for the fields tier, owner, country&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="srv007_2-1691604279711.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/26717i73FF77EAF9D07041/image-size/medium?v=v2&amp;amp;px=400" role="button" title="srv007_2-1691604279711.png" alt="srv007_2-1691604279711.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;end requirement is to do lookup for the vm_name in itso.csv file and add details like tier, countrycode, owner in the main search output.&lt;/P&gt;</description>
      <pubDate>Sat, 12 Aug 2023 07:21:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-wild-cards-suffix-values-from-values-of-hostname/m-p/653789#M225948</guid>
      <dc:creator>srv007</dc:creator>
      <dc:date>2023-08-12T07:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: Remove wild cards/suffix values from values of hostname</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-wild-cards-suffix-values-from-values-of-hostname/m-p/653790#M225949</link>
      <description>&lt;P&gt;##Note - Also point to be noted that some hostname can be of 6 characters some can be 8 and like so extracting hostname as number of characters might not be suitable.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 18:11:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-wild-cards-suffix-values-from-values-of-hostname/m-p/653790#M225949</guid>
      <dc:creator>srv007</dc:creator>
      <dc:date>2023-08-09T18:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove wild cards/suffix values from values of hostname?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-wild-cards-suffix-values-from-values-of-hostname/m-p/654047#M226011</link>
      <description>&lt;P&gt;Any guidance/help is appreciated&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2023 10:09:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-wild-cards-suffix-values-from-values-of-hostname/m-p/654047#M226011</guid>
      <dc:creator>srv007</dc:creator>
      <dc:date>2023-08-11T10:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove wild cards/suffix values from values of hostname?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-wild-cards-suffix-values-from-values-of-hostname/m-p/654137#M226029</link>
      <description>&lt;P&gt;I suspect that people got confused by the field name "vm_name". &amp;nbsp;From your description, this is a free-text field that users can add additional string after the real hostname. &amp;nbsp;Dealing with human input can be challenging. &amp;nbsp;It will depend on how careful the user is, what kind of separator they use after hostname, and what characteristics the hostname string may have.&lt;/P&gt;&lt;P&gt;Take the simplest case where the user always added a white space before entering their comments (and that hostname itself doesn't contain white space, and that there is no leading whitespace in the field), you can do&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="inm_inventory"
|dedup vm_name | search vm_name="*old*" OR vm_name="*restore*"
| eval vm_name = mvindex(split(vm_name, " "), 0)
|table inventory_date, region, vm_name, version&lt;/LI-CODE&gt;&lt;P&gt;(I moved table command to last as this can improve performance. &amp;nbsp;If you want to restrict number of fields carried into dedup command, use fields instead of table.)&lt;/P&gt;</description>
      <pubDate>Sat, 12 Aug 2023 00:20:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-wild-cards-suffix-values-from-values-of-hostname/m-p/654137#M226029</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-08-12T00:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove wild cards/suffix values from values of hostname?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-wild-cards-suffix-values-from-values-of-hostname/m-p/654147#M226036</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex field=vm_name "^(?&amp;lt;real_vm_name&amp;gt;[a-z0-9]+)"
| lookup itso.csv hostname as real_vm_name&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 12 Aug 2023 07:01:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-wild-cards-suffix-values-from-values-of-hostname/m-p/654147#M226036</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-12T07:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove wild cards/suffix values from values of hostname?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-wild-cards-suffix-values-from-values-of-hostname/m-p/654270#M226079</link>
      <description>&lt;P&gt;This did help actually.&lt;BR /&gt;few hosts have entries like ###gbl12344 - old###&lt;BR /&gt;anyway to fetch only hostname for such cases?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 11:52:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-wild-cards-suffix-values-from-values-of-hostname/m-p/654270#M226079</guid>
      <dc:creator>srv007</dc:creator>
      <dc:date>2023-08-14T11:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove wild cards/suffix values from values of hostname?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-wild-cards-suffix-values-from-values-of-hostname/m-p/654276#M226080</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex field=vm_name "^#*(?&amp;lt;real_vm_name&amp;gt;[a-z0-9]+)"&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 14 Aug 2023 12:26:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-wild-cards-suffix-values-from-values-of-hostname/m-p/654276#M226080</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-14T12:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove wild cards/suffix values from values of hostname?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-wild-cards-suffix-values-from-values-of-hostname/m-p/654293#M226084</link>
      <description>&lt;P&gt;Given that no real hostname begins with pound sign, you can use ltrim.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="inm_inventory"
|dedup vm_name | search vm_name="*old*" OR vm_name="*restore*"
| eval vm_name = ltrim(mvindex(split(vm_name, " "), 0), "#")
|table inventory_date, region, vm_name, version&lt;/LI-CODE&gt;&lt;P&gt;ltrim and split use fixed patterns, &amp;nbsp;therefore less compute and RAM.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 16:51:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-wild-cards-suffix-values-from-values-of-hostname/m-p/654293#M226084</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-08-14T16:51:44Z</dc:date>
    </item>
  </channel>
</rss>

