<?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 create an alert when a new forwarder is added to deployment server? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357344#M65256</link>
    <description>&lt;P&gt;I'm looking for a way to report/alert anytime a new forwarder is added to my deployment server. I've tried searching on internal with the following search, but this isn't unique to when a forwarder is initially added to our environment. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype=splunkd component=PubSubSvr host=&amp;lt;deploymentServer&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 01 May 2017 17:44:41 GMT</pubDate>
    <dc:creator>merrelr</dc:creator>
    <dc:date>2017-05-01T17:44:41Z</dc:date>
    <item>
      <title>How to create an alert when a new forwarder is added to deployment server?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357344#M65256</link>
      <description>&lt;P&gt;I'm looking for a way to report/alert anytime a new forwarder is added to my deployment server. I've tried searching on internal with the following search, but this isn't unique to when a forwarder is initially added to our environment. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype=splunkd component=PubSubSvr host=&amp;lt;deploymentServer&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 May 2017 17:44:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357344#M65256</guid>
      <dc:creator>merrelr</dc:creator>
      <dc:date>2017-05-01T17:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an alert when a new forwarder is added to deployment server?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357345#M65257</link>
      <description>&lt;P&gt;Hello merrelr,&lt;BR /&gt;
you can create a lookup table of all forwarders:&lt;BR /&gt;
&lt;CODE&gt;| tstats count where index = _* by host | table host | outputlookup forwarders.csv&lt;/CODE&gt;&lt;BR /&gt;
and let it run as a schedule search. now you can search and compare results to lookup to check who is new on your forwarders list:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   | tstats count where index = _* by host | search NOT [inputlookup forwarders.csv | fields+ host]
     | stats values(host) AS new_hosts
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you can also use the &lt;CODE&gt;| metadata&lt;/CODE&gt; command and search for newly received data leveraging the firstTime field&lt;BR /&gt;
more in this answer:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/321024/compare-search-to-lookup-table-and-return-results.html"&gt;https://answers.splunk.com/answers/321024/compare-search-to-lookup-table-and-return-results.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2017 17:58:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357345#M65257</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2017-05-01T17:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an alert when a new forwarder is added to deployment server?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357346#M65258</link>
      <description>&lt;P&gt;This is very helpful!&lt;/P&gt;

&lt;P&gt;Although when i enter the query to compare the results, I get the below error. &lt;/P&gt;

&lt;P&gt;"Search Factory: Unknown search command 'not'."  &lt;/P&gt;

&lt;P&gt;I tried playing around with the query but did not have any luck. &lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2017 19:15:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357346#M65258</guid>
      <dc:creator>bbraun</dc:creator>
      <dc:date>2017-05-17T19:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an alert when a new forwarder is added to deployment server?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357347#M65259</link>
      <description>&lt;P&gt;I get the same error, "Search Factory: Unknown search command 'not'."&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 18:01:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357347#M65259</guid>
      <dc:creator>jlh3dz</dc:creator>
      <dc:date>2017-06-20T18:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an alert when a new forwarder is added to deployment server?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357348#M65260</link>
      <description>&lt;P&gt;I found the answer.  "search" is missing.  Use &lt;BR /&gt;
| tstats count where index = _* by host | search NOT [inputlookup forwarders.csv | fields+ host]&lt;BR /&gt;
      | stats values(host) AS new_hosts&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:32:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357348#M65260</guid>
      <dc:creator>jlh3dz</dc:creator>
      <dc:date>2020-09-29T14:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an alert when a new forwarder is added to deployment server?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357349#M65261</link>
      <description>&lt;P&gt;This worked!  Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 20:22:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357349#M65261</guid>
      <dc:creator>bbraun</dc:creator>
      <dc:date>2017-06-21T20:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an alert when a new forwarder is added to deployment server?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357350#M65262</link>
      <description>&lt;P&gt;@bbraun&lt;BR /&gt;
modified the answer to reflect, indeed forgot to put the search after pie. this is the reason for your error, there is no NOT  command &lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 20:57:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357350#M65262</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2017-06-21T20:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an alert when a new forwarder is added to deployment server?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357351#M65263</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| tstats count where index = _* by host | search NOT [| inputlookup forwarders.csv | fields+ host]
      | stats values(host) AS new_hosts
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;There should be a pipe before inputlookup. &lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 13:11:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357351#M65263</guid>
      <dc:creator>buckiboy</dc:creator>
      <dc:date>2019-08-01T13:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an alert when a new forwarder is added to deployment server?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357352#M65264</link>
      <description>&lt;P&gt;Greetings @merrelr,&lt;/P&gt;

&lt;P&gt;The current provided answers would work. This is how I would do it though:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metadata type=hosts
| eval daysSinceFirstTime = round((now() - firstTime)/86400, 2)
| eval hoursSinceLastTime = round((now() - lastTime )/3600 , 2)
| convert ctime(firstTime) as firstTime
| convert ctime(lastTime)  as lastTime
| search daysSinceFirstTime &amp;lt; 1 OR (hoursSinceLastTime&amp;gt;24 AND hoursSinceLastTime&amp;lt;48)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this example, you could run the alert search once a day to get all hosts that sent their first event to your indexer(s) in the past day and hosts that sent their last event to your indexer(s) between 24 and 48 hours ago. Run the search for all time as this is an extremely efficient command.&lt;/P&gt;

&lt;P&gt;Refer &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Metadata"&gt;here&lt;/A&gt; for the &lt;CODE&gt;metadata&lt;/CODE&gt; command documentation.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 14:01:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/357352#M65264</guid>
      <dc:creator>jacobpevans</dc:creator>
      <dc:date>2019-08-01T14:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an alert when a new forwarder is added to deployment server?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/586905#M103132</link>
      <description>&lt;P&gt;Edit: This one should be more accurate and will also let you use the date picker.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_internal host="SPLUNK_DS_NAME" component=PubSubSvr event_message="Subscribed*"
| eval hostname=mvindex(split(connectionId, "_"), 4)
| search hostname!="direct"
| eval guid=mvindex(split(connectionId, "_"), 5)
| dedup guid sortby +_time
| join guid type=inner [search index=_internal host="SPLUNK_DS_NAME" component=PubSubSvr event_message="Subscribed*" earliest=1
| eval hostname=mvindex(split(connectionId, "_"), 4)
| search hostname!="direct"
| eval guid=mvindex(split(connectionId, "_"), 5)
| eval h_time=_time
| dedup guid sortby +_time 
| fields guid, h_time]
| addinfo
| eval firstSeenDiff=_time-h_time
| eval pickerDiff=now()-info_min_time
| where pickerDiff&amp;gt;=firstSeenDiff
| eval lastSeen=strftime(_time, "%Y-%m-%d %H:%M:%S")
| eval firstSeen=strftime(h_time, "%Y-%m-%d %H:%M:%S")
| table lastSeen, firstSeen, guid, hostname&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This seems to be the earliest date stamp of events, not the forwarder check-in.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_internal source=*metrics.log group=tcpin_connections
| dedup guid
| table _time, guid, hostname&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Simplified version of&amp;nbsp;&lt;A href="https://community.splunk.com/t5/Deployment-Architecture/How-to-identify-a-list-of-forwarders-sending-data-to-a-single/m-p/106014/highlight/true#M3945" target="_blank" rel="noopener"&gt;Solved: Re: Listing forwarders - Splunk Community&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;&lt;STRIKE&gt;I then realized this was just for forwarders sending data. Although it would be strange, you can have forwarders connected to just the DS.&lt;/STRIKE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_internal host="SPLUNK_DS_HOSTNAME" component=PubSubSvr event_message="Subscribed*"
| eval hostname=mvindex(split(connectionId, "_"), 4)
| search hostname!="direct"
| eval guid=mvindex(split(connectionId, "_"), 5)
| dedup guid sortby +_time 
| table _time, guid, hostname&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2022 20:00:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-create-an-alert-when-a-new-forwarder-is-added-to/m-p/586905#M103132</guid>
      <dc:creator>Tyler</dc:creator>
      <dc:date>2022-03-04T20:00:09Z</dc:date>
    </item>
  </channel>
</rss>

