<?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 Need help to visualize the query in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487010#M31909</link>
    <description>&lt;P&gt;Hi Guys,&lt;/P&gt;

&lt;P&gt;I have the following query and query result, i am struggling to show it in graph:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=infra_apps sourcetype=ca:atsys:edemon:txt
| search Job=*
| rename hostname as host 
| eval time_epoch=strftime(_time,"%Y-%m-%d %H:%M:%S") 
| fields Job host Autosysjob_time Status _time time_epoch 
| lookup datalakenodeslist.csv host OUTPUT cluster
| mvexpand cluster
| table Job Status host cluster _time time_epoch
| search cluster=* AND host=*
| sort + time_epoch
| stats count  by _time Job Status host cluster time_epoch
| bin span=2m time_epoch
| makecontinuous  _time span=2m
| filldown _time Job Status host cluster count time_epoch
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Query result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time   Job Status  host    cluster time_epoch  count
3/3/2020 8:00   1CDH_ING_NBC_ACCT_MSTR_DY_CURR_HG                       STARTING    XXXX    edl-prd-m01 43893.33337 1
3/3/2020 8:00   1CDH_ING_NBC_ACCT_OB_PRIM_CK_DY_TMPRL_BMG     STARTING  XXXX    edl-prd-m01 43893.33338 1
3/3/2020 8:00   1CDH_ING_NBC_EVNT_CUST_ID_CHG_HY_HIST_CIS        RUNNING    XXXXX   edl-prd-m01 43893.33372 1
3/3/2020 8:00   1CDH_ING_NBC_EVNT_CUST_PH_CHG_HY_HIST_CIS        RUNNING    XXXX    edl-prd-m01 43893.33372 1
3/3/2020 9:00   1CDH_ING_NBC_EVNT_CUST_PH_CHG_HY_HIST_CIS        RUNNING    XXXX    edl-prd-m01 43893.33372 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now i am struggling to show how many jobs are running or starting at each minute , can you please help&lt;/P&gt;</description>
    <pubDate>Wed, 04 Mar 2020 13:52:06 GMT</pubDate>
    <dc:creator>pench2k19</dc:creator>
    <dc:date>2020-03-04T13:52:06Z</dc:date>
    <item>
      <title>Need help to visualize the query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487010#M31909</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;

&lt;P&gt;I have the following query and query result, i am struggling to show it in graph:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=infra_apps sourcetype=ca:atsys:edemon:txt
| search Job=*
| rename hostname as host 
| eval time_epoch=strftime(_time,"%Y-%m-%d %H:%M:%S") 
| fields Job host Autosysjob_time Status _time time_epoch 
| lookup datalakenodeslist.csv host OUTPUT cluster
| mvexpand cluster
| table Job Status host cluster _time time_epoch
| search cluster=* AND host=*
| sort + time_epoch
| stats count  by _time Job Status host cluster time_epoch
| bin span=2m time_epoch
| makecontinuous  _time span=2m
| filldown _time Job Status host cluster count time_epoch
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Query result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time   Job Status  host    cluster time_epoch  count
3/3/2020 8:00   1CDH_ING_NBC_ACCT_MSTR_DY_CURR_HG                       STARTING    XXXX    edl-prd-m01 43893.33337 1
3/3/2020 8:00   1CDH_ING_NBC_ACCT_OB_PRIM_CK_DY_TMPRL_BMG     STARTING  XXXX    edl-prd-m01 43893.33338 1
3/3/2020 8:00   1CDH_ING_NBC_EVNT_CUST_ID_CHG_HY_HIST_CIS        RUNNING    XXXXX   edl-prd-m01 43893.33372 1
3/3/2020 8:00   1CDH_ING_NBC_EVNT_CUST_PH_CHG_HY_HIST_CIS        RUNNING    XXXX    edl-prd-m01 43893.33372 1
3/3/2020 9:00   1CDH_ING_NBC_EVNT_CUST_PH_CHG_HY_HIST_CIS        RUNNING    XXXX    edl-prd-m01 43893.33372 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now i am struggling to show how many jobs are running or starting at each minute , can you please help&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 13:52:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487010#M31909</guid>
      <dc:creator>pench2k19</dc:creator>
      <dc:date>2020-03-04T13:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to visualize the query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487011#M31910</link>
      <description>&lt;P&gt;Try adding &lt;CODE&gt;| timechart span=1m count by Status&lt;/CODE&gt; to the end of your query.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 18:05:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487011#M31910</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-03-04T18:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to visualize the query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487012#M31911</link>
      <description>&lt;P&gt;@richgalloway  this is not helping....&lt;/P&gt;

&lt;P&gt;I just want to give you some back ground about this..I have a single event for each job status in splunk&lt;/P&gt;

&lt;P&gt;But to make it continuous i am inserting 2 mins interval using bin and makecontinous command and filling those intervals with the last status it updated,&lt;/P&gt;

&lt;P&gt;For example if its running status at 9 am and success status at 10 am, i am creating 2m interval between that 1 hour gap and filling it with Running status.&lt;/P&gt;

&lt;P&gt;I suspect that is one of the reason i am not able to get that in graph as i am expexting.&lt;/P&gt;

&lt;P&gt;PS: I am getting the correct result till the filldown command, after that i am struggling.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 09:29:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487012#M31911</guid>
      <dc:creator>pench2k19</dc:creator>
      <dc:date>2020-03-05T09:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to visualize the query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487013#M31912</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=infra_apps sourcetype=ca:atsys:edemon:txt
| search Job=*
| rename hostname as host 
| eval time_epoch=strftime(_time,"%Y-%m-%d %H:%M:%S")
| fields Job host Autosysjob_time Status _time time_epoch
| lookup datalakenodeslist.csv host OUTPUT cluster 
| mvexpand cluster
| table Job Status host cluster _time time_epoch
| search cluster=EDL-PRD-M01 AND host=*
| sort + time_epoch
| stats count  by _time Job Status host cluster time_epoch
| bin span=2m _time
| makecontinuous span=2m _time
| filldown _time Job Status host cluster count time_epoch
| stats count by _time Status
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;this is giving me the correct result, but i am not able have a filter in the query like search Status=RUNNING for example, When i add the status filter its giving me different result.&lt;/P&gt;

&lt;P&gt;@woodcock  @jka can you please help.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 10:33:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487013#M31912</guid>
      <dc:creator>pench2k19</dc:creator>
      <dc:date>2020-03-05T10:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to visualize the query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487014#M31913</link>
      <description>&lt;P&gt;@woodcock @jkat54  @somesoni2 @sideview can you please help&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 08:18:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487014#M31913</guid>
      <dc:creator>pench2k19</dc:creator>
      <dc:date>2020-03-09T08:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to visualize the query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487015#M31914</link>
      <description>&lt;P&gt;I think the core problem, or at the very least a major source of confusion,  is that you're taking _time, which is already an integer value (the number of seconds since big ben rang out the new year in 1970),  and turning it into a string-formatted time, naming that field "time_epoch" which is SUPER confusing because its values are string-formatted times, not epochtime integers. &lt;/P&gt;

&lt;P&gt;Then sorting by that string formatted time.  This is a little odd but so far not really a problem - just weird since the original _time value can do all that perfectly well too. &lt;/P&gt;

&lt;P&gt;Wild guess - you're getting confused by the behavior of the Splunk UI - whenever it sees any field called "_time" it sneakily sneaks in and on-the-fly converts the &lt;EM&gt;display&lt;/EM&gt; of those values to string-formatted times. However the values underneath are epochtime integers.  you can always verify that I'm not talking crazy by doing &lt;CODE&gt;| eval srsly_wat=_time&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Then anyway, back to our story the problem arises with this - &lt;BR /&gt;
&lt;CODE&gt;| bin span=2m time_epoch&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;that would make sense if time_epoch was actually an epochtime-valued field, ie if it held integer values.  It makes no sense however in this case where the "time_epoch" field holds strings.  Bin has no idea what to do with this combination of field and value,  and so what it does is -- nothing at all.  it throws no error but it does nothing. &lt;/P&gt;

&lt;P&gt;I think if you fix that core issue,  you might be able to revisit what you're trying to do with the bin+makecontinuous +filldown.  re-examining that fresh, with some fresh caffeine,  is a good idea. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=infra_apps sourcetype=ca:atsys:edemon:txt
 | search Job=*
 | rename hostname as host 
 | fields Job host Autosysjob_time Status _time 
 | lookup datalakenodeslist.csv host OUTPUT cluster
 | mvexpand cluster
 | table Job Status host cluster _time 
 | search cluster=* AND host=*
 | sort + _time
 | stats count  by _time Job Status host cluster 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is  bit of an instinct, but I have seen many cases where people where folks are fiddling with bin+makecontinuous+filldown basically trying to recreate one of timechart's core use cases, beacuse they've come to believe that timechart can't do it. &lt;/P&gt;

&lt;P&gt;I hope this helps - I don't think it's your whole answer, but I think it clears some of the mess up and puts you in a better place.  and i'll update this answer if you post back etc. &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:31:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487015#M31914</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2020-09-30T04:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to visualize the query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487016#M31915</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/103"&gt;@sideview&lt;/a&gt;  thanks for such detailed explanation.&lt;/P&gt;

&lt;P&gt;The following the is the latest query i am using &lt;BR /&gt;
index=infra_apps sourcetype=ca:atsys:edemon:txt&lt;BR /&gt;
| search Job=*&lt;BR /&gt;
| rename hostname as host&lt;BR /&gt;
| eval t1=strftime(_time,"%Y-%m-%d %H:%M:%S")&lt;BR /&gt;
| eval time_epoch=strptime(t1,"%Y-%m-%d %H:%M:%S")&lt;BR /&gt;
| fields Job host Autosysjob_time Status _time time_epoch t1&lt;BR /&gt;
| lookup datalakenodeslist.csv host OUTPUT cluster &lt;BR /&gt;
| mvexpand cluster&lt;BR /&gt;
| table Job Status host cluster _time time_epoch&lt;BR /&gt;
| search cluster=EDL-PRD-M01 AND host=*&lt;BR /&gt;
| sort + time_epoch&lt;BR /&gt;
| stats count  by _time Job Status host cluster time_epoch&lt;BR /&gt;
| bin span=2m _time&lt;BR /&gt;
| makecontinuous span=2m _time&lt;BR /&gt;
| filldown _time Job Status host cluster count time_epoch&lt;/P&gt;

&lt;P&gt;Sorting the resutls before stats command with _time was not working for me , thats why i had to use time_epoch.&lt;/P&gt;

&lt;P&gt;And i tried using &lt;STRONG&gt;| bin span=2m time_epoch&lt;/STRONG&gt; and  &lt;STRONG&gt;| bin span=2m _time&lt;/STRONG&gt; but these are giving me different results at times , i still confused what to use on this line.&lt;/P&gt;

&lt;P&gt;P S: Example of how _time being extracted in this case is &lt;STRONG&gt;2020-03-09 10:00:03.863&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:35:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487016#M31915</guid>
      <dc:creator>pench2k19</dc:creator>
      <dc:date>2020-09-30T04:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to visualize the query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487017#M31916</link>
      <description>&lt;P&gt;I just got a query derived for no of running jobs at each time as follows&lt;/P&gt;

&lt;P&gt;index=XXX sourcetype=YYYY EventCode=40 AND (Status=Failure OR Status=Terminated OR Status=Running OR Status=Success) AppID=$appid$ Machine=$host$ Job=$job$&lt;BR /&gt;
| dedup _raw &lt;BR /&gt;
| lookup datalakenodeslist.csv host as Machine OUTPUT cluster &lt;BR /&gt;
| search cluster=$clustername$ &lt;BR /&gt;
| eval running=if(Status="RUNNING","1","0"),status=if(Status="RUNNING","start","stop"), time=_time+status &lt;BR /&gt;
| bin span=2m _time &lt;BR /&gt;
| stats max(running) as running, earliest(time) as first, latest(time) as last by Job,_time &lt;BR /&gt;
| xyseries _time Job running first last &lt;BR /&gt;
| makecontinuous span=2m _time &lt;BR /&gt;
| streamstats window=2 global=f earliest(last*) as last* &lt;BR /&gt;
| reverse &lt;BR /&gt;
| streamstats window=2 global=f earliest(first*) as first* &lt;BR /&gt;
| reverse &lt;BR /&gt;
| foreach running* &lt;BR /&gt;
    [ eval &amp;lt;&lt;FIELD&gt;&amp;gt;=if(isnull('&amp;lt;&lt;FIELD&gt;&amp;gt;') AND like('first&amp;lt;&lt;MATCHSTR&gt;&amp;gt;',"%start"),"0",if(isnull('&amp;lt;&lt;FIELD&gt;&amp;gt;') AND like('first&amp;lt;&lt;MATCHSTR&gt;&amp;gt;',"%stop"),"1",if(isnull('&amp;lt;&lt;FIELD&gt;&amp;gt;') AND like('last&amp;lt;&lt;MATCHSTR&gt;&amp;gt;',"%start"),"1",if(isnull('&amp;lt;&lt;FIELD&gt;&amp;gt;') AND like('last&amp;lt;&lt;MATCHSTR&gt;&amp;gt;',"%stop"),"0",'&amp;lt;&lt;FIELD&gt;&amp;gt;'))))] &lt;BR /&gt;
| fields - first*, last* &lt;BR /&gt;
| filldown * &lt;BR /&gt;
| reverse &lt;BR /&gt;
| filldown * &lt;BR /&gt;
| reverse &lt;BR /&gt;
| addtotals fieldname=Running &lt;BR /&gt;
| fields _time,Running&lt;/FIELD&gt;&lt;/MATCHSTR&gt;&lt;/FIELD&gt;&lt;/MATCHSTR&gt;&lt;/FIELD&gt;&lt;/MATCHSTR&gt;&lt;/FIELD&gt;&lt;/MATCHSTR&gt;&lt;/FIELD&gt;&lt;/FIELD&gt;&lt;/P&gt;

&lt;P&gt;But i find it too difficult to just understand the query :(, and not able to edit this query to have single query for both RUNNING and STARTING statuses.&lt;/P&gt;

&lt;P&gt;Can you please help to have a single query for both the statuses.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:36:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487017#M31916</guid>
      <dc:creator>pench2k19</dc:creator>
      <dc:date>2020-09-30T04:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to visualize the query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487018#M31917</link>
      <description>&lt;P&gt;You should take a look at the &lt;CODE&gt;concurrency&lt;/CODE&gt; command and the answers.splunk.com articles about it.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Mar 2020 20:29:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Need-help-to-visualize-the-query/m-p/487018#M31917</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-14T20:29:30Z</dc:date>
    </item>
  </channel>
</rss>

