<?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 to run a diff search with a Head 2 command across multiple systems? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-diff-search-with-a-Head-2-command-across-multiple/m-p/384230#M112219</link>
    <description>&lt;P&gt;I have developed a search, with help years ago, that will show differences in a netstat command using "diff" and "head 2".&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo host=bar sourcetype=netstat 
| head 2 
| diff
| search NOT "Results are the Same"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The netstat runs every hour with a scripted input, and the search runs hourly to see if anything has changed.  If it has, an alert fires.&lt;/P&gt;

&lt;P&gt;As you can see, the search specifies a host.  However, what if I wanted to run this search across many hosts?  Would I have to create a separate search for each host?  Or is there some Splunk magic I can utilize?&lt;/P&gt;

&lt;P&gt;Thanks for your time!&lt;/P&gt;</description>
    <pubDate>Thu, 14 Jun 2018 15:56:53 GMT</pubDate>
    <dc:creator>aferone</dc:creator>
    <dc:date>2018-06-14T15:56:53Z</dc:date>
    <item>
      <title>How to run a diff search with a Head 2 command across multiple systems?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-diff-search-with-a-Head-2-command-across-multiple/m-p/384230#M112219</link>
      <description>&lt;P&gt;I have developed a search, with help years ago, that will show differences in a netstat command using "diff" and "head 2".&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo host=bar sourcetype=netstat 
| head 2 
| diff
| search NOT "Results are the Same"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The netstat runs every hour with a scripted input, and the search runs hourly to see if anything has changed.  If it has, an alert fires.&lt;/P&gt;

&lt;P&gt;As you can see, the search specifies a host.  However, what if I wanted to run this search across many hosts?  Would I have to create a separate search for each host?  Or is there some Splunk magic I can utilize?&lt;/P&gt;

&lt;P&gt;Thanks for your time!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 15:56:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-diff-search-with-a-Head-2-command-across-multiple/m-p/384230#M112219</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2018-06-14T15:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a diff search with a Head 2 command across multiple systems?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-diff-search-with-a-Head-2-command-across-multiple/m-p/384231#M112220</link>
      <description>&lt;P&gt;Can you not do dedup host?&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
 index=foo host=* sourcetype=netstat &lt;BR /&gt;
 | dedup 2  host&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 16:48:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-diff-search-with-a-Head-2-command-across-multiple/m-p/384231#M112220</guid>
      <dc:creator>pradeepkumarg</dc:creator>
      <dc:date>2018-06-14T16:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a diff search with a Head 2 command across multiple systems?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-diff-search-with-a-Head-2-command-across-multiple/m-p/384232#M112221</link>
      <description>&lt;P&gt;Can you explain this a little further on what this would be doing?  Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 18:52:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-diff-search-with-a-Head-2-command-across-multiple/m-p/384232#M112221</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2018-06-14T18:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a diff search with a Head 2 command across multiple systems?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-diff-search-with-a-Head-2-command-across-multiple/m-p/384233#M112222</link>
      <description>&lt;P&gt;so | head 2 will give you the latest 2 entries for the host you specified.&lt;/P&gt;

&lt;P&gt;by making host=* and adding | dedup 2 host, you are retaining the latest 2 entries for every host&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 19:56:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-diff-search-with-a-Head-2-command-across-multiple/m-p/384233#M112222</guid>
      <dc:creator>pradeepkumarg</dc:creator>
      <dc:date>2018-06-14T19:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a diff search with a Head 2 command across multiple systems?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-diff-search-with-a-Head-2-command-across-multiple/m-p/384234#M112223</link>
      <description>&lt;P&gt;The diff command can only compare 2 result/row, so having multiple host entries would not work. If you don't need "diff command type output" and just looking to alert when current netstat output of a host is different then previous entry, you can do something like this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo sourcetype=netstat 
| table host _raw | dedup 2 host
| streamstats count as sno by host
| chart values(_raw) over host by sno
| where '1'!='2'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The dedup command will just list two entries for a host, most recent and 2nd recent. The streamstats command just give a serial number to them which'll be 1 and 2 since there will be only two entries after dedup. The chart command will give a output with field host, 1 (which will have most recent event's raw data) and 2 (which will have 2nd recent event's raw data). The where clause just compare both.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 20:50:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-diff-search-with-a-Head-2-command-across-multiple/m-p/384234#M112223</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-06-14T20:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a diff search with a Head 2 command across multiple systems?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-diff-search-with-a-Head-2-command-across-multiple/m-p/384235#M112224</link>
      <description>&lt;P&gt;Sorry for the delay, and thank you for posting! . I will be trying this soon.  Thanks again!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 19:14:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-diff-search-with-a-Head-2-command-across-multiple/m-p/384235#M112224</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2018-06-21T19:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a diff search with a Head 2 command across multiple systems?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-diff-search-with-a-Head-2-command-across-multiple/m-p/384236#M112225</link>
      <description>&lt;P&gt;This looks very promising.  I am pushing our netstat config to more boxes to test this.  Where does "sno" come into play in the search?  Thanks again!!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 19:17:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-diff-search-with-a-Head-2-command-across-multiple/m-p/384236#M112225</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2018-06-21T19:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a diff search with a Head 2 command across multiple systems?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-diff-search-with-a-Head-2-command-across-multiple/m-p/384237#M112226</link>
      <description>&lt;P&gt;The search is definitely working, and thank you!&lt;/P&gt;

&lt;P&gt;But for some reason, when I set it up as an alert, I can't get it to send an email?  I am setting it to "events greater to zero", just like every other alert we've configured.  &lt;/P&gt;

&lt;P&gt;Am I missing something?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 14:02:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-a-diff-search-with-a-Head-2-command-across-multiple/m-p/384237#M112226</guid>
      <dc:creator>aferone</dc:creator>
      <dc:date>2018-06-25T14:02:50Z</dc:date>
    </item>
  </channel>
</rss>

