<?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 Re: get process time and group by status in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/get-process-time-and-group-by-status/m-p/452223#M128058</link>
    <description>&lt;P&gt;hello Gaurav, i tried 1=1, but the problem is cell value not overwritten,, it show two rows  &lt;CODE&gt;Running completed&lt;/CODE&gt;.&lt;/P&gt;</description>
    <pubDate>Tue, 20 Aug 2019 06:58:22 GMT</pubDate>
    <dc:creator>hazemfarajallah</dc:creator>
    <dc:date>2019-08-20T06:58:22Z</dc:date>
    <item>
      <title>get process time and group by status</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-process-time-and-group-by-status/m-p/452217#M128052</link>
      <description>&lt;P&gt;Hello everyone &lt;BR /&gt;
I'm using  this query &lt;BR /&gt;
`|eval Status = case (eventId="endProcess" ,"Completed" ,eventId="error","Terminated") &lt;BR /&gt;
|stats earliest(when) AS startTime latest(when) AS endTime by mainprocessname ,resourceName&lt;BR /&gt;
|eval startTime = strftime( strptime( startTime, "%Y-%m-%dT%H:%M:%S.%7NZ"), "%Y-%m-%d %H:%M:%S")&lt;BR /&gt;
|eval endTime = strftime( strptime( endTime, "%Y-%m-%dT%H:%M:%S.%7NZ"), "%Y-%m-%d %H:%M:%S")&lt;/P&gt;

&lt;P&gt;|table startTime, endTime , mainprocessname,Status ,resourceName&lt;CODE&gt;&lt;BR /&gt;
wondering how to set the status in the table?  if i use it as by with Stats earliest, I will have only the result from the same event (it will effect startTime and endtime so its in event level  )&lt;BR /&gt;
any idea how to add the status to the table ? or should I change me eval status &lt;BR /&gt;
OR how to get the status from the event with the same sessionid&lt;BR /&gt;
here is sample of my data &lt;BR /&gt;
&lt;/CODE&gt;  currprocessid:  b0bb7d67-aed1-4877-8340-65d1a4bdf87d &lt;BR /&gt;
    currprocessname:  17 - Dödsbo inkorg - Skapa kö &lt;BR /&gt;
    currprocesstype:  0 &lt;BR /&gt;
    eventId:  endSubSheetRef &lt;BR /&gt;
    mainprocessid:  b0bb7d67-aed1-4877-8340-65d1a4bdf87d &lt;BR /&gt;
    mainprocessname:  17 - xxxxx&lt;BR /&gt;
    pageid:  00000000-0000-0000-0000-000000000000 &lt;BR /&gt;
    pagename:  Main Page &lt;BR /&gt;
    resourceName:  HP20082212 &lt;BR /&gt;
    sessionNumber:  3313 &lt;BR /&gt;
    sessionid:  615d19b9-1f01-4a60-b524-fe7ac0c1b360 &lt;BR /&gt;
    stageid:  6b293685-aea0-4394-bfc6-3e9147aa6775 &lt;BR /&gt;
    stagename:  xxSAP &lt;BR /&gt;
    when:  2019-08-16T09:44:08.1262931Z`&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 10:17:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-process-time-and-group-by-status/m-p/452217#M128052</guid>
      <dc:creator>hazemfarajallah</dc:creator>
      <dc:date>2019-08-16T10:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: get process time and group by status</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-process-time-and-group-by-status/m-p/452218#M128053</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;The &lt;CODE&gt;stats&lt;/CODE&gt; command produces a statistical summarization of data. The reason your &lt;CODE&gt;Status&lt;/CODE&gt; field doesn't appear in your table command is because stats summarized your primary search into a smaller result set containing only a count for each value of fields provided with &lt;CODE&gt;stats&lt;/CODE&gt; after &lt;CODE&gt;by&lt;/CODE&gt;. &lt;/P&gt;

&lt;P&gt;What you might do is use the &lt;CODE&gt;values()&lt;/CODE&gt; stats function to include &lt;CODE&gt;Status&lt;/CODE&gt; values in your result set.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval Status = case (eventId="endProcess" ,"Completed" ,eventId="error","Terminated")
|stats earliest(when) AS startTime, latest(when) AS endTime, values(Status) AS Status by mainprocessname ,resourceName
|eval startTime = strftime( strptime( startTime, "%Y-%m-%dT%H:%M:%S.%7NZ"), "%Y-%m-%d %H:%M:%S")
|eval endTime = strftime( strptime( endTime, "%Y-%m-%dT%H:%M:%S.%7NZ"), "%Y-%m-%d %H:%M:%S")
|table startTime, endTime , mainprocessname, Status, resourceName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Accept &amp;amp; Upvote the answer if it helps.&lt;/P&gt;

&lt;P&gt;Happy splunking............!!!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 14:24:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-process-time-and-group-by-status/m-p/452218#M128053</guid>
      <dc:creator>gaurav_maniar</dc:creator>
      <dc:date>2019-08-16T14:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: get process time and group by status</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-process-time-and-group-by-status/m-p/452219#M128054</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
thanks for answering,&lt;BR /&gt;
its works only if the right status on the same event where is Start time or endTime, &lt;/P&gt;

&lt;P&gt;is there is any way to check the event during the All the process from start to finish?&lt;BR /&gt;
like loop through them then add to the table ?&lt;/P&gt;

&lt;P&gt;Thanks in advance .&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 06:55:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-process-time-and-group-by-status/m-p/452219#M128054</guid>
      <dc:creator>hazemfarajallah</dc:creator>
      <dc:date>2019-08-19T06:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: get process time and group by status</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-process-time-and-group-by-status/m-p/452220#M128055</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I didn't understand your question.&lt;BR /&gt;
I guess you want group events by starttime and endtime.&lt;/P&gt;

&lt;P&gt;Instead of using &lt;CODE&gt;stats&lt;/CODE&gt;, you can group your events by &lt;CODE&gt;transaction&lt;/CODE&gt; command.&lt;BR /&gt;
After the &lt;CODE&gt;transaction&lt;/CODE&gt; command apply your status logic and use it in table.&lt;/P&gt;

&lt;P&gt;For example - &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.1/SearchReference/Transaction"&gt;https://docs.splunk.com/Documentation/Splunk/7.3.1/SearchReference/Transaction&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/7.2.6/Search/Identifyandgroupeventsintotransactions"&gt;https://docs.splunk.com/Documentation/SplunkCloud/7.2.6/Search/Identifyandgroupeventsintotransactions&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Accept &amp;amp; Upvote the answer if it helps.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 09:40:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-process-time-and-group-by-status/m-p/452220#M128055</guid>
      <dc:creator>gaurav_maniar</dc:creator>
      <dc:date>2019-08-19T09:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: get process time and group by status</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-process-time-and-group-by-status/m-p/452221#M128056</link>
      <description>&lt;P&gt;Thanks, i managed with &lt;CODE&gt;Stats&lt;/CODE&gt; having one problem left &lt;BR /&gt;
during the process running  &lt;CODE&gt;|eval Status = case (eventId="endProcess" ,"Completed" ,eventId="error","Terminated")'&lt;/CODE&gt;&lt;BR /&gt;
how to set default value?&lt;BR /&gt;
i tried to use not equal but then there is many not equal and the Status cell will have to value ex.  ´Completed then under 'Running ´ cant remove running from the cell after an update . &lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 13:44:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-process-time-and-group-by-status/m-p/452221#M128056</guid>
      <dc:creator>hazemfarajallah</dc:creator>
      <dc:date>2019-08-19T13:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: get process time and group by status</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-process-time-and-group-by-status/m-p/452222#M128057</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;|eval Status = case (eventId="endProcess" ,"Completed" ,eventId="error","Terminated", 1=1, "your_default_value")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Aug 2019 14:46:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-process-time-and-group-by-status/m-p/452222#M128057</guid>
      <dc:creator>gaurav_maniar</dc:creator>
      <dc:date>2019-08-19T14:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: get process time and group by status</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-process-time-and-group-by-status/m-p/452223#M128058</link>
      <description>&lt;P&gt;hello Gaurav, i tried 1=1, but the problem is cell value not overwritten,, it show two rows  &lt;CODE&gt;Running completed&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 06:58:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-process-time-and-group-by-status/m-p/452223#M128058</guid>
      <dc:creator>hazemfarajallah</dc:creator>
      <dc:date>2019-08-20T06:58:22Z</dc:date>
    </item>
  </channel>
</rss>

