<?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 separate a search by groups of hosts? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-separate-a-search-by-groups-of-hosts/m-p/348707#M103210</link>
    <description>&lt;P&gt;Off the top of my head, I would extract a field to be the domain and group by that.&lt;/P&gt;

&lt;P&gt;So, something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;hosts=* 
| rex field=host "\.(?\w+\.\w+)"
| timechart span=1m count by domain_name
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 24 Apr 2017 20:25:53 GMT</pubDate>
    <dc:creator>lycollicott</dc:creator>
    <dc:date>2017-04-24T20:25:53Z</dc:date>
    <item>
      <title>How to separate a search by groups of hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-separate-a-search-by-groups-of-hosts/m-p/348706#M103209</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;

&lt;P&gt;If I run this query, I'll get a graph of the # of queries over time aggregated for all of my hosts.&lt;/P&gt;

&lt;P&gt;host=* | timechart per_minute(Query) &lt;/P&gt;

&lt;P&gt;If I run this query, I'll have a similar graph with one line shown per host.&lt;/P&gt;

&lt;P&gt;host=* | timechart per_minute(Query) by host&lt;/P&gt;

&lt;P&gt;Is there any way to graph by groups of hosts?  Say, by the domain of the server.&lt;/P&gt;

&lt;P&gt;example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=* | timechart per_minute(Query) by group (a, b, c) where group a like "*.a.com" and group b like "*.b.com" and group c like "*.c.com"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Apr 2017 20:21:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-separate-a-search-by-groups-of-hosts/m-p/348706#M103209</guid>
      <dc:creator>meleschi</dc:creator>
      <dc:date>2017-04-24T20:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to separate a search by groups of hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-separate-a-search-by-groups-of-hosts/m-p/348707#M103210</link>
      <description>&lt;P&gt;Off the top of my head, I would extract a field to be the domain and group by that.&lt;/P&gt;

&lt;P&gt;So, something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;hosts=* 
| rex field=host "\.(?\w+\.\w+)"
| timechart span=1m count by domain_name
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Apr 2017 20:25:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-separate-a-search-by-groups-of-hosts/m-p/348707#M103210</guid>
      <dc:creator>lycollicott</dc:creator>
      <dc:date>2017-04-24T20:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to separate a search by groups of hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-separate-a-search-by-groups-of-hosts/m-p/348708#M103211</link>
      <description>&lt;P&gt;You can create a field with those criteria/specification and they group by those.&lt;BR /&gt;
e.g.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; host=* | eval group=case(like(host,"%.a.com"),"group a",like(host,"%.b.com"),"group b",...other sets here, 1=1,"defauly") | timechart per_minute(Query) by group
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you're only interested in group a/b/c (you don't want to statistics for other domains, add them as filter in the base search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; host=*.a.com OR host=*.b.com OR host=*.c.com  | eval group=case(like(host,"%.a.com"),"group a",like(host,"%.b.com"),"group b",...other sets here, 1=1,"defauly") | timechart per_minute(Query) by group
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Apr 2017 20:37:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-separate-a-search-by-groups-of-hosts/m-p/348708#M103211</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-04-24T20:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to separate a search by groups of hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-separate-a-search-by-groups-of-hosts/m-p/348709#M103212</link>
      <description>&lt;P&gt;Thank you for both answers above.  I ended up placing some data in a lookup table, and using that to break apart servers by region, type, etc.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 22:05:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-separate-a-search-by-groups-of-hosts/m-p/348709#M103212</guid>
      <dc:creator>meleschi</dc:creator>
      <dc:date>2019-11-22T22:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to separate a search by groups of hosts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-separate-a-search-by-groups-of-hosts/m-p/348710#M103213</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; host=*
| rex field=host mode=sed "s/^[^\.]+/\*/"
| timechart per_minute(Query) BY host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 23 Nov 2019 06:38:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-separate-a-search-by-groups-of-hosts/m-p/348710#M103213</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-23T06:38:10Z</dc:date>
    </item>
  </channel>
</rss>

