<?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: Query against a list of computers in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Query-against-a-list-of-computers/m-p/199523#M57778</link>
    <description>&lt;P&gt;You are looking for mac - wait for it - ros! Macros!&lt;/P&gt;

&lt;P&gt;You can define them in either macros.conf or via the UI.&lt;/P&gt;

&lt;P&gt;Put your host list (as a search string) in the macro (we'll call it &lt;CODE&gt;tv_host_list&lt;/CODE&gt;). &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=TV-host1 OR host=TV-host2 OR ......
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then reference the macro in any other search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=-1d@d `tv_host_list` | do other things here.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And here's a doc for you: &lt;CODE&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.1/Search/UseSearchMacros" target="test_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.0.1/Search/UseSearchMacros&lt;/A&gt;&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Find us on IRC! Efnet channel #splunk! Live help (and maybe some trout slapping!)! &lt;STRONG&gt;not officially official help - customers and such&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Jan 2014 14:30:28 GMT</pubDate>
    <dc:creator>alacercogitatus</dc:creator>
    <dc:date>2014-01-10T14:30:28Z</dc:date>
    <item>
      <title>Query against a list of computers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-against-a-list-of-computers/m-p/199522#M57777</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt;
We have a bunch of searches that are being run against a specific set of hosts (we'll say:&lt;/P&gt;

&lt;P&gt;TV-host1, TV-host2, TD-host1, TD-host2&lt;/P&gt;

&lt;P&gt;i want a way to run a set of saved searches against a list of hosts specified in another saved search.&lt;/P&gt;

&lt;P&gt;I currently am doing this in the following method:&lt;/P&gt;

&lt;P&gt;savedsearch1:&lt;BR /&gt;
host="T*-host*"&lt;/P&gt;

&lt;P&gt;saved searches that use this:&lt;BR /&gt;
| savedsearch1 | rest of query&lt;/P&gt;

&lt;P&gt;I realize that this is extremely inefficient because it pulls all the logs for those hosts, then narrows down the results from there.&lt;/P&gt;

&lt;P&gt;Is there a way to take the actual search syntax from a saved search and apply it to another search inline?  &lt;/P&gt;

&lt;P&gt;The reason I'm asking this is because I want some saved searches set so that it queries against specific hosts, and if we have a new naming standard, then all I need to do is modify the search that handles the hostnames, rather than modifying 25 other searches and modifying the host syntax on those.&lt;/P&gt;

&lt;P&gt;Another question I have, is there a way to narrow down hostname based on a regex, rather than the any character *?&lt;/P&gt;

&lt;P&gt;Such as T*-host[0-9]*&lt;/P&gt;

&lt;P&gt;So that would find TV-host1, but not TV-hoster2?&lt;/P&gt;

&lt;P&gt;We have a couple of hosts that are named similar, and it is confusing some of the saved searches we have.&lt;/P&gt;

&lt;P&gt;Thanks for any assistance you could provide&lt;/P&gt;

&lt;P&gt;-Jeff&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:37:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-against-a-list-of-computers/m-p/199522#M57777</guid>
      <dc:creator>raidercom</dc:creator>
      <dc:date>2020-09-28T15:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: Query against a list of computers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-against-a-list-of-computers/m-p/199523#M57778</link>
      <description>&lt;P&gt;You are looking for mac - wait for it - ros! Macros!&lt;/P&gt;

&lt;P&gt;You can define them in either macros.conf or via the UI.&lt;/P&gt;

&lt;P&gt;Put your host list (as a search string) in the macro (we'll call it &lt;CODE&gt;tv_host_list&lt;/CODE&gt;). &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=TV-host1 OR host=TV-host2 OR ......
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then reference the macro in any other search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=-1d@d `tv_host_list` | do other things here.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And here's a doc for you: &lt;CODE&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.1/Search/UseSearchMacros" target="test_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.0.1/Search/UseSearchMacros&lt;/A&gt;&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Find us on IRC! Efnet channel #splunk! Live help (and maybe some trout slapping!)! &lt;STRONG&gt;not officially official help - customers and such&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2014 14:30:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-against-a-list-of-computers/m-p/199523#M57778</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2014-01-10T14:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: Query against a list of computers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-against-a-list-of-computers/m-p/199524#M57779</link>
      <description>&lt;P&gt;That is exactly what I am looking for.&lt;BR /&gt;
Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2014 15:52:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-against-a-list-of-computers/m-p/199524#M57779</guid>
      <dc:creator>raidercom</dc:creator>
      <dc:date>2014-01-10T15:52:12Z</dc:date>
    </item>
  </channel>
</rss>

