<?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: If I have servers with a host name format of host_1, host_2, host_3, etc, how can I search a range of hosts by hostname? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/If-I-have-servers-with-a-host-name-format-of-host-1-host-2-host/m-p/214854#M63011</link>
    <description>&lt;P&gt;Hi @idab&lt;/P&gt;

&lt;P&gt;Be sure to accept the answer that solved your question best, otherwise this will appear to other users as unresolved. Thanks!&lt;/P&gt;

&lt;P&gt;Patrick&lt;/P&gt;</description>
    <pubDate>Wed, 09 Sep 2015 01:02:56 GMT</pubDate>
    <dc:creator>ppablo</dc:creator>
    <dc:date>2015-09-09T01:02:56Z</dc:date>
    <item>
      <title>If I have servers with a host name format of host_1, host_2, host_3, etc, how can I search a range of hosts by hostname?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-I-have-servers-with-a-host-name-format-of-host-1-host-2-host/m-p/214849#M63006</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have 25 servers with the same prefix name and suffixed with different number host _1, host_2 ., ......, host_25.&lt;/P&gt;

&lt;P&gt;How do you write a search to spool only the servers names from host_11 up to host_23? Instead of using the exclude operator (!=) on the hosts you don't need.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* counter="*"  Host="host _1*"    | eval Value = round(Value,1)| timechart  span=5m first(Value) by host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:13:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-I-have-servers-with-a-host-name-format-of-host-1-host-2-host/m-p/214849#M63006</guid>
      <dc:creator>idab</dc:creator>
      <dc:date>2020-09-29T07:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: If I have servers with a host name format of host_1, host_2, host_3, etc, how can I search a range of hosts by hostname?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-I-have-servers-with-a-host-name-format-of-host-1-host-2-host/m-p/214850#M63007</link>
      <description>&lt;P&gt;Something like this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* counter="*"  (Host="host_1*" OR Host="host_2*") | rex field=Host "host_(?&amp;lt;suffix&amp;gt;\d+)" | where suffix&amp;gt;10 AND suffix &amp;lt; 24 | eval Value = round(Value,1)| timechart  span=5m first(Value) by host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Sep 2015 20:34:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-I-have-servers-with-a-host-name-format-of-host-1-host-2-host/m-p/214850#M63007</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-09-04T20:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: If I have servers with a host name format of host_1, host_2, host_3, etc, how can I search a range of hosts by hostname?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-I-have-servers-with-a-host-name-format-of-host-1-host-2-host/m-p/214851#M63008</link>
      <description>&lt;P&gt;Assuming that your host name have same name with suffix as number (1,2,3...24,25) no left padding, try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index= index=* counter="*"  [| gentimes start=-1 | eval Host=mvrange(11,24) | table Host | mvexpand Host | eval Host="YourHostSuffix_".Host ]    | eval Value = round(Value,1)| timechart  span=5m first(Value) by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The subsearch will dynamically generate a OR condition as    &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Host=YourHostSuffix_11 OR Host=YourHostSuffix_12 OR.... OR Host=YourHostSuffix_23
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;. The only thing you need to provide is the suffix (YourHostSuffix above) and start index (11 in mvrange command) and End range (end range+1 =24 in mvrange).&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2015 21:29:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-I-have-servers-with-a-host-name-format-of-host-1-host-2-host/m-p/214851#M63008</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-09-04T21:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: If I have servers with a host name format of host_1, host_2, host_3, etc, how can I search a range of hosts by hostname?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-I-have-servers-with-a-host-name-format-of-host-1-host-2-host/m-p/214852#M63009</link>
      <description>&lt;P&gt;Thanks richgallowway!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2015 15:45:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-I-have-servers-with-a-host-name-format-of-host-1-host-2-host/m-p/214852#M63009</guid>
      <dc:creator>idab</dc:creator>
      <dc:date>2015-09-08T15:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: If I have servers with a host name format of host_1, host_2, host_3, etc, how can I search a range of hosts by hostname?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-I-have-servers-with-a-host-name-format-of-host-1-host-2-host/m-p/214853#M63010</link>
      <description>&lt;P&gt;Thanks somesoni2&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2015 15:45:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-I-have-servers-with-a-host-name-format-of-host-1-host-2-host/m-p/214853#M63010</guid>
      <dc:creator>idab</dc:creator>
      <dc:date>2015-09-08T15:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: If I have servers with a host name format of host_1, host_2, host_3, etc, how can I search a range of hosts by hostname?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-I-have-servers-with-a-host-name-format-of-host-1-host-2-host/m-p/214854#M63011</link>
      <description>&lt;P&gt;Hi @idab&lt;/P&gt;

&lt;P&gt;Be sure to accept the answer that solved your question best, otherwise this will appear to other users as unresolved. Thanks!&lt;/P&gt;

&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 01:02:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-I-have-servers-with-a-host-name-format-of-host-1-host-2-host/m-p/214854#M63011</guid>
      <dc:creator>ppablo</dc:creator>
      <dc:date>2015-09-09T01:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: If I have servers with a host name format of host_1, host_2, host_3, etc, how can I search a range of hosts by hostname?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-I-have-servers-with-a-host-name-format-of-host-1-host-2-host/m-p/214855#M63012</link>
      <description>&lt;P&gt;I saw someone else do this before was a bit surprised it even worked.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index= index=* counter="*"   (host=host_1* OR  host=host_2*)  (host &amp;gt;= host_1 AND host &amp;lt;= host_25)  | eval Value = round(Value,1)| timechart  span=5m first(Value) by host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Sep 2015 05:08:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-I-have-servers-with-a-host-name-format-of-host-1-host-2-host/m-p/214855#M63012</guid>
      <dc:creator>cramasta</dc:creator>
      <dc:date>2015-09-11T05:08:09Z</dc:date>
    </item>
  </channel>
</rss>

