<?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 How can i search 1 host at a time when index hits a number of hosts. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-search-1-host-at-a-time-when-index-hits-a-number-of/m-p/583439#M203169</link>
    <description>&lt;P&gt;I have an index which searches across 10 hosts. I am comparing 2 strings and evaluating the results to see if there is an issue that needs alerting. The results are being messed up as its evaluating the 2 strings from 2 different boxes - ie string1 on hostA against string2 on hostB.&amp;nbsp; It should be string1 on host1 against string2 on host1. Then go to host2 , host3 ..... host10.&lt;/P&gt;&lt;P&gt;How can i get my search to either sequentionally go through each host or have the results group by host to not show results that have come from 2 diff hosts.&amp;nbsp;&lt;/P&gt;&lt;P&gt;current logic is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;index="abc" "string1 OR string2" | transaction startswith="string1" endswith="string2" | where count&amp;gt;2&lt;/P&gt;</description>
    <pubDate>Wed, 02 Feb 2022 18:33:51 GMT</pubDate>
    <dc:creator>HelloItsMe76</dc:creator>
    <dc:date>2022-02-02T18:33:51Z</dc:date>
    <item>
      <title>How can i search 1 host at a time when index hits a number of hosts.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-search-1-host-at-a-time-when-index-hits-a-number-of/m-p/583439#M203169</link>
      <description>&lt;P&gt;I have an index which searches across 10 hosts. I am comparing 2 strings and evaluating the results to see if there is an issue that needs alerting. The results are being messed up as its evaluating the 2 strings from 2 different boxes - ie string1 on hostA against string2 on hostB.&amp;nbsp; It should be string1 on host1 against string2 on host1. Then go to host2 , host3 ..... host10.&lt;/P&gt;&lt;P&gt;How can i get my search to either sequentionally go through each host or have the results group by host to not show results that have come from 2 diff hosts.&amp;nbsp;&lt;/P&gt;&lt;P&gt;current logic is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;index="abc" "string1 OR string2" | transaction startswith="string1" endswith="string2" | where count&amp;gt;2&lt;/P&gt;</description>
      <pubDate>Wed, 02 Feb 2022 18:33:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-search-1-host-at-a-time-when-index-hits-a-number-of/m-p/583439#M203169</guid>
      <dc:creator>HelloItsMe76</dc:creator>
      <dc:date>2022-02-02T18:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: How can i search 1 host at a time when index hits a number of hosts.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-search-1-host-at-a-time-when-index-hits-a-number-of/m-p/583447#M203173</link>
      <description>Can you post sample events to understand your needs?</description>
      <pubDate>Wed, 02 Feb 2022 21:15:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-search-1-host-at-a-time-when-index-hits-a-number-of/m-p/583447#M203173</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2022-02-02T21:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: How can i search 1 host at a time when index hits a number of hosts.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-search-1-host-at-a-time-when-index-hits-a-number-of/m-p/583482#M203179</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/242719"&gt;@HelloItsMe76&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;let me understand:&lt;/P&gt;&lt;P&gt;you want to check if there's a group of hosts (at least 2 or more) where there are both the strings, is this correct?&lt;/P&gt;&lt;P&gt;please try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="abc" "string1 OR string2" 
| eval string=if(searchmatch("string1"),"String1","String2")
| stats dc(host) AS dc_host values(host) AS host dc(string) AS dc_string
| where dc_host&amp;gt;1 AND dc_string&amp;gt;1
| mvexpand host
| table host&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 07:16:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-search-1-host-at-a-time-when-index-hits-a-number-of/m-p/583482#M203179</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-02-03T07:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: How can i search 1 host at a time when index hits a number of hosts.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-search-1-host-at-a-time-when-index-hits-a-number-of/m-p/583598#M203229</link>
      <description>&lt;P&gt;Thanks for the reply..&lt;/P&gt;&lt;P&gt;one small update to my original post is that it should read "duration &amp;gt; 2" at the end.&lt;/P&gt;&lt;P&gt;to clarify -&amp;nbsp; both strings will appear in all the 10 hosts. at the moment my search is comparing strings from different hosts, it should not do that. I understand i can create 10 alerts (1 for each host), but i would like to find a more efficient way and do it in 1 alert.&amp;nbsp; So i am looking to go through each host in the source / index and evaluate string1 vs string2 on host1, then go to host2 and so on up to host10.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 16:37:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-search-1-host-at-a-time-when-index-hits-a-number-of/m-p/583598#M203229</guid>
      <dc:creator>HelloItsMe76</dc:creator>
      <dc:date>2022-02-03T16:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: How can i search 1 host at a time when index hits a number of hosts.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-search-1-host-at-a-time-when-index-hits-a-number-of/m-p/583609#M203232</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/242719"&gt;@HelloItsMe76&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if you need also to check duration, you have to modify the search, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="abc" "string1 OR string2" 
| eval string=if(searchmatch("string1"),"String1","String2")
| stats dc(host) AS dc_host values(host) AS host dc(string) AS dc_string earliest(_time) AS earliest latest(_time) AS latest
| eval duration=latest-earliest
| where dc_host&amp;gt;1 AND dc_string&amp;gt;1 AND duration&amp;gt;2
| mvexpand host
| table host &lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 17:15:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-search-1-host-at-a-time-when-index-hits-a-number-of/m-p/583609#M203232</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-02-03T17:15:34Z</dc:date>
    </item>
  </channel>
</rss>

