<?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 Listing sources not having a match in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Listing-sources-not-having-a-match/m-p/675182#M231049</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I've a simple requirement but new to Splunk so facing some challenges and hoping for some luck!&lt;/P&gt;&lt;P&gt;My application writes HEARTBEAT messages every 2 min to log files to multiple sources. I'm just trying to create an alert and send email if heartbeat messages aren't written in last 5 min.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It may look simple but I also need to know which sources doesn't have heartbeat messages.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried with below query which works but sometimes giving me incorrect results. So, looking for an better and simple solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;index = index1 earliest=-5m latest=now  source IN (dev-*api.log) ("testapi" AND "HEARTBEAT")
| fields source
| append [ search index = index1 earliest=-2w@w0 latest=now source IN (dev-*api.log) ("testapi" AND "HEARTBEAT")
    | stats dc(source) as source_list by source
    | fields source
    ] 
| rex field=_raw "HEARTBEAT for (?&amp;lt;APIName&amp;gt;.*).jar (?&amp;lt;Version&amp;gt;.*)"
| stats count as #heartbeats, latest(Version) as Versions by APIName, JVM
| eval Status=case(('#heartbeats' &amp;lt;= 1 OR isnull('#heartbeats')), "NOT RUNNING", '#heartbeats' &amp;gt; 1, "RUNNING")
| table APIName, Versions, Status&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate the help! Thanks.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jan 2024 14:52:37 GMT</pubDate>
    <dc:creator>nnkreddy</dc:creator>
    <dc:date>2024-01-23T14:52:37Z</dc:date>
    <item>
      <title>Listing sources not having a match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Listing-sources-not-having-a-match/m-p/675182#M231049</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I've a simple requirement but new to Splunk so facing some challenges and hoping for some luck!&lt;/P&gt;&lt;P&gt;My application writes HEARTBEAT messages every 2 min to log files to multiple sources. I'm just trying to create an alert and send email if heartbeat messages aren't written in last 5 min.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It may look simple but I also need to know which sources doesn't have heartbeat messages.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried with below query which works but sometimes giving me incorrect results. So, looking for an better and simple solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;index = index1 earliest=-5m latest=now  source IN (dev-*api.log) ("testapi" AND "HEARTBEAT")
| fields source
| append [ search index = index1 earliest=-2w@w0 latest=now source IN (dev-*api.log) ("testapi" AND "HEARTBEAT")
    | stats dc(source) as source_list by source
    | fields source
    ] 
| rex field=_raw "HEARTBEAT for (?&amp;lt;APIName&amp;gt;.*).jar (?&amp;lt;Version&amp;gt;.*)"
| stats count as #heartbeats, latest(Version) as Versions by APIName, JVM
| eval Status=case(('#heartbeats' &amp;lt;= 1 OR isnull('#heartbeats')), "NOT RUNNING", '#heartbeats' &amp;gt; 1, "RUNNING")
| table APIName, Versions, Status&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate the help! Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 14:52:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Listing-sources-not-having-a-match/m-p/675182#M231049</guid>
      <dc:creator>nnkreddy</dc:creator>
      <dc:date>2024-01-23T14:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Listing sources not having a match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Listing-sources-not-having-a-match/m-p/675185#M231051</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/264263"&gt;@nnkreddy&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if you're confident that you received an event in the last 24 hours, you could run something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index = index1 earliest=-24h latest=now  source IN (dev-*api.log) ("testapi" AND "HEARTBEAT")
| stats latest(_time) AS latest BY APIName, JVM
| where latest&amp;gt;now()-300&lt;/LI-CODE&gt;&lt;P&gt;If you're not sure that you received at least one event in the last 24 hours, you have to create a lookup&amp;nbsp; (called e.g. perimeter.csv) containing all the&amp;nbsp;APIName and JVM to monitor, then you can run something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index = index1 earliest=-m5 latest=now  source IN (dev-*api.log) ("testapi" AND "HEARTBEAT")
| stats count BY APIName, JVM
| append [ | inputlookup perimeter.cv | eval count=0 | fields APIName JVM count ]
| stats sum(count) AS total BY APIName, JVM
| where total=0&lt;/LI-CODE&gt;&lt;P&gt;The second search is less heavy and long to execute and gives more control, but requires to manage the lookup.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 14:50:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Listing-sources-not-having-a-match/m-p/675185#M231051</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-01-23T14:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: Listing sources not having a match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Listing-sources-not-having-a-match/m-p/675202#M231056</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Option 1 is the smart solution without complicating it - its working perfectly fine! Thanks for the help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 16:57:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Listing-sources-not-having-a-match/m-p/675202#M231056</guid>
      <dc:creator>nnkreddy</dc:creator>
      <dc:date>2024-01-23T16:57:41Z</dc:date>
    </item>
  </channel>
</rss>

