<?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: Why are similar rows not grouping together? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-are-similar-rows-not-grouping-together/m-p/609092#M211788</link>
    <description>&lt;P&gt;This is probably a result of trailing spaces on your split by fields.&lt;/P&gt;&lt;P&gt;Your rex statement for serviceTicketId is greedy, in that it grabs everything&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=serviceTicketId "\[(?&amp;lt;omsServiceTicketId&amp;gt;.*)\]&lt;/LI-CODE&gt;&lt;P&gt;If you do a final&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval serviceTicketId=":".serviceTicketId.":"&lt;/LI-CODE&gt;&lt;P&gt;and the same with orderId you will see if there's a leading/trailing space.&lt;/P&gt;&lt;P&gt;Couple of other points - dc(_time) will count unique times, but if you have two events at the same time, you will only get 1. Should you use 'count' instead.&lt;/P&gt;&lt;P&gt;Also elapsedTime calculation will not work for the multivalue eventTime field.&lt;/P&gt;&lt;P&gt;You could do this&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;...
| stats count AS eventCount min(_time) as firstEvent values(_time) AS eventTime values(appId) AS app BY serviceTicketId orderId
| eval timeElapsed = now() - firstEvent&lt;/LI-CODE&gt;&lt;P&gt;or if you want to do elapsed time between first and last event of the particular ticket, do&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;...
| stats count AS eventCount range(_time) as timeElapsed values(_time) AS eventTime values(appId) AS app BY serviceTicketId orderId&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Aug 2022 00:10:15 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2022-08-11T00:10:15Z</dc:date>
    <item>
      <title>Why are similar rows not grouping together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-similar-rows-not-grouping-together/m-p/609087#M211784</link>
      <description>&lt;P&gt;For some reason there are entries that are not grouped together, but obviously look like they should be. In the following table, 2 rows with serviceTicketId =&amp;nbsp;&lt;SPAN&gt;00dcfe68-25d8-4c58-9228-5fc8f7ddb9d1 are on separate rows, other serviceTicketIds such as&amp;nbsp;00c093f4fc527e5ff7006566b1a0fd90 have one row, but multiple event times.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-08-10 at 3.59.11 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/20994i681D11C53F9AFF9C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-08-10 at 3.59.11 PM.png" alt="Screen Shot 2022-08-10 at 3.59.11 PM.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Here is my query:&lt;/P&gt;
&lt;PRE&gt;&lt;BR /&gt;(index=k8s_main "*Published successfully event=[com.nordstrom.customer.event.OrderLineReturnReceived*") OR (index="k8s_main" cluster="nsk-oak-prod" "namespace"=app04096 "*doPost - RequestId*") OR (index=k8s_main container_name=fraud-single-proxy-listener message="Successfully sent payload to kafka topic=order-events-avro*" contextMap.eventType="OrderLineReturnReceived")&lt;BR /&gt;| rename contextMap.orderId AS nefiOrderId contextMap.serviceTicketId AS nefiServiceTicketId&lt;BR /&gt;| rex field=eventKey "\[(?&amp;lt;omsOrderId&amp;gt;.*)\]"&lt;BR /&gt;| rex field=serviceTicketId "\[(?&amp;lt;omsServiceTicketId&amp;gt;.*)\]"&lt;BR /&gt;| rex "RequestId:(?&amp;lt;omniServiceTicketId&amp;gt;.*? )"&lt;BR /&gt;| rex "\"orderNumber\":\"(?&amp;lt;omniOrderId&amp;gt;.*?)\""&lt;BR /&gt;| eval appId = mvappend(container_name, app)&lt;BR /&gt;| eval orderId = mvappend(nefiOrderId, omsOrderId, omniOrderId)&lt;BR /&gt;| eval serviceTicketId = mvappend(nefiServiceTicketId, omsServiceTicketId, omniServiceTicketId) &lt;BR /&gt;| stats dc(_time) AS eventCount values(_time) AS eventTime values(appId) AS app BY serviceTicketId orderId&lt;BR /&gt;| eval timeElapsed = now() - eventTime&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 22:03:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-similar-rows-not-grouping-together/m-p/609087#M211784</guid>
      <dc:creator>scaparelli</dc:creator>
      <dc:date>2022-08-10T22:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: Why are similar rows not grouping together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-similar-rows-not-grouping-together/m-p/609092#M211788</link>
      <description>&lt;P&gt;This is probably a result of trailing spaces on your split by fields.&lt;/P&gt;&lt;P&gt;Your rex statement for serviceTicketId is greedy, in that it grabs everything&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=serviceTicketId "\[(?&amp;lt;omsServiceTicketId&amp;gt;.*)\]&lt;/LI-CODE&gt;&lt;P&gt;If you do a final&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval serviceTicketId=":".serviceTicketId.":"&lt;/LI-CODE&gt;&lt;P&gt;and the same with orderId you will see if there's a leading/trailing space.&lt;/P&gt;&lt;P&gt;Couple of other points - dc(_time) will count unique times, but if you have two events at the same time, you will only get 1. Should you use 'count' instead.&lt;/P&gt;&lt;P&gt;Also elapsedTime calculation will not work for the multivalue eventTime field.&lt;/P&gt;&lt;P&gt;You could do this&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;...
| stats count AS eventCount min(_time) as firstEvent values(_time) AS eventTime values(appId) AS app BY serviceTicketId orderId
| eval timeElapsed = now() - firstEvent&lt;/LI-CODE&gt;&lt;P&gt;or if you want to do elapsed time between first and last event of the particular ticket, do&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;...
| stats count AS eventCount range(_time) as timeElapsed values(_time) AS eventTime values(appId) AS app BY serviceTicketId orderId&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2022 00:10:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-similar-rows-not-grouping-together/m-p/609092#M211788</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-08-11T00:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why are similar rows not grouping together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-similar-rows-not-grouping-together/m-p/609411#M211910</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;...&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt; Your rex statement for serviceTicketId is greedy, in that it grabs everything&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=serviceTicketId "\[(?&amp;lt;omsServiceTicketId&amp;gt;.*)\]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;yes, that is true, ... one should almost never use the greedy grep(".*" )..&lt;/P&gt;&lt;P&gt;now, then, whats ur suggestion about how we should modify this rex?.. (i think we may need the logs to modify the rex, right)&lt;/P&gt;</description>
      <pubDate>Sat, 13 Aug 2022 17:18:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-similar-rows-not-grouping-together/m-p/609411#M211910</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2022-08-13T17:18:30Z</dc:date>
    </item>
  </channel>
</rss>

