<?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 Show a 0 if no data on a source in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Show-a-0-if-no-data-on-a-source/m-p/670833#M229926</link>
    <description>&lt;P&gt;Hello community,&lt;/P&gt;&lt;P&gt;I'm having a problem that's probably easy to solve, but I can't figure it out.&lt;/P&gt;&lt;P&gt;I have a query that will query an index that contains alerts from Splunk OnCall. And I count each alert source (via the associated routingkey from OnCall) and its status (Acknowledged or not).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;`victorops_incidents`  | sort lastAlertTime desc | dedup incidentNumber | fields * | search org="*" routingKey=** pagedPolicies{}.policy.name!=0_Reroute_alertes currentPhase!=RESOLVED
| eval currentPhase=case(like(currentPhase, "%UNACKED%"), "Non acquitté", like(currentPhase, "%ACKED%"), "En cours") 
| eval routingKey=case(like(routingKey, "%routingcontrol-m%"), "Control-M", like(routingKey, "%dyn%"), "Dynatrace", like(routingKey, "%centreon%"), "Centreon", like(routingKey, "%servicepilot%"), "ServicePilot", like(routingKey, "%p_1%"), "P1")
| rename currentPhase as Etat, routingKey as Source
| chart count by Etat, Source
| sort - Etat&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;I have an almost perfect table which summarizes everything but I am missing some information: I sometimes have a source which has not generated any alert so it is absent from the table (in the screen below, I have the sources "Control-M", "Dynatrace" and "ServicePilot" but I am missing "Centreon" because the latter did not have any incidents in the period of time) :&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rajaion_0-1701784707699.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28380iF7D61DC52722940C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rajaion_0-1701784707699.png" alt="Rajaion_0-1701784707699.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;My question is the following: how to make all the sources appear but display 0 when they have not had any alerts?&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Rajaion&lt;/P&gt;</description>
    <pubDate>Tue, 05 Dec 2023 13:58:58 GMT</pubDate>
    <dc:creator>Rajaion</dc:creator>
    <dc:date>2023-12-05T13:58:58Z</dc:date>
    <item>
      <title>Show a 0 if no data on a source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-a-0-if-no-data-on-a-source/m-p/670833#M229926</link>
      <description>&lt;P&gt;Hello community,&lt;/P&gt;&lt;P&gt;I'm having a problem that's probably easy to solve, but I can't figure it out.&lt;/P&gt;&lt;P&gt;I have a query that will query an index that contains alerts from Splunk OnCall. And I count each alert source (via the associated routingkey from OnCall) and its status (Acknowledged or not).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;`victorops_incidents`  | sort lastAlertTime desc | dedup incidentNumber | fields * | search org="*" routingKey=** pagedPolicies{}.policy.name!=0_Reroute_alertes currentPhase!=RESOLVED
| eval currentPhase=case(like(currentPhase, "%UNACKED%"), "Non acquitté", like(currentPhase, "%ACKED%"), "En cours") 
| eval routingKey=case(like(routingKey, "%routingcontrol-m%"), "Control-M", like(routingKey, "%dyn%"), "Dynatrace", like(routingKey, "%centreon%"), "Centreon", like(routingKey, "%servicepilot%"), "ServicePilot", like(routingKey, "%p_1%"), "P1")
| rename currentPhase as Etat, routingKey as Source
| chart count by Etat, Source
| sort - Etat&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;I have an almost perfect table which summarizes everything but I am missing some information: I sometimes have a source which has not generated any alert so it is absent from the table (in the screen below, I have the sources "Control-M", "Dynatrace" and "ServicePilot" but I am missing "Centreon" because the latter did not have any incidents in the period of time) :&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rajaion_0-1701784707699.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28380iF7D61DC52722940C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rajaion_0-1701784707699.png" alt="Rajaion_0-1701784707699.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;My question is the following: how to make all the sources appear but display 0 when they have not had any alerts?&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Rajaion&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 13:58:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-a-0-if-no-data-on-a-source/m-p/670833#M229926</guid>
      <dc:creator>Rajaion</dc:creator>
      <dc:date>2023-12-05T13:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: Show a 0 if no data on a source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-a-0-if-no-data-on-a-source/m-p/670837#M229927</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| table Etat, "Control-M", "Dynatrace", "ServicePilot", "Centreon"
| fillnull value=0&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 05 Dec 2023 14:08:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-a-0-if-no-data-on-a-source/m-p/670837#M229927</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-12-05T14:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Show a 0 if no data on a source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-a-0-if-no-data-on-a-source/m-p/670869#M229942</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Thank you for your help, I have my source "Centreon" but it does not display 0 yet. I had already tried the "fillnull" but poorly because it created extra fields.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rajaion_0-1701791257646.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28381i6C24A9A05BE74B8B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rajaion_0-1701791257646.png" alt="Rajaion_0-1701791257646.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;BR /&gt;&lt;BR /&gt;Rajaion&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 15:58:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-a-0-if-no-data-on-a-source/m-p/670869#M229942</guid>
      <dc:creator>Rajaion</dc:creator>
      <dc:date>2023-12-05T15:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Show a 0 if no data on a source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-a-0-if-no-data-on-a-source/m-p/670873#M229943</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| table Etat, "Control-M", "Dynatrace", "ServicePilot", "Centreon"
| fillnull value=0 "Control-M", "Dynatrace", "ServicePilot", "Centreon"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 05 Dec 2023 16:10:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-a-0-if-no-data-on-a-source/m-p/670873#M229943</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-12-05T16:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: Show a 0 if no data on a source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-a-0-if-no-data-on-a-source/m-p/670874#M229944</link>
      <description>&lt;P&gt;By manually setting for a source, it works, even if it is not optimal.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval "Centreon"=if(isnull(Centreon),0,'Centreon')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 16:11:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-a-0-if-no-data-on-a-source/m-p/670874#M229944</guid>
      <dc:creator>Rajaion</dc:creator>
      <dc:date>2023-12-05T16:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: Show a 0 if no data on a source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-a-0-if-no-data-on-a-source/m-p/670877#M229945</link>
      <description>&lt;P&gt;I just saw your new message, it works even better and it's cleaner.&lt;BR /&gt;Thank you for your help !&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rajaion_0-1701792781806.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28382i8E62A02C59C6AA51/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rajaion_0-1701792781806.png" alt="Rajaion_0-1701792781806.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 16:13:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-a-0-if-no-data-on-a-source/m-p/670877#M229945</guid>
      <dc:creator>Rajaion</dc:creator>
      <dc:date>2023-12-05T16:13:14Z</dc:date>
    </item>
  </channel>
</rss>

