<?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: how to avoid breaking event order of multi value field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-avoid-breaking-event-order-of-multi-value-field/m-p/486657#M136117</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="1##121,5646435,2019-01-30 12:44:54,2019-01-30 12:56:58,jesse" 
| appendpipe 
    [ eval _raw="2##5654655|CommonText|121|45453235|Some Text|Text|Text|Text|Text|jesse|30-JAN-2019 12.58.51.00 PM||||"] 
| rex "^(?:1##)(?&amp;lt;Customer_ID&amp;gt;\d+),\d+,(?&amp;lt;Purchase_Time&amp;gt;\d{4}-\d\d-\d\d \d\d:\d\d:\d\d),.+,(?&amp;lt;Customer_Name&amp;gt;\w+$)"
| rex "^(?:2##)\d+\|\w+\|(?&amp;lt;Customer_ID&amp;gt;\d+)\|.*\|(?&amp;lt;Customer_Name&amp;gt;\w+)\|(?&amp;lt;Closing_Time&amp;gt;\d\d-\w+-\d{4} \d\d\.\d\d\.\d\d\.\d\d \w\w)\|*\|*\|*\|$"
| stats values(*) as * by Customer_ID
| table Customer_ID Customer_Name Purchase_Time Closing_Time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Regular expressions are hard.&lt;/P&gt;

&lt;P&gt;Hi, @sharif_ahmmad&lt;BR /&gt;
How about this?&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;ALT:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="1##121,5646435,2019-01-30 12:44:54,2019-01-30 12:56:58,jesse" 
| appendpipe 
    [ eval _raw="2##5654655|CommonText|121|45453235|Some Text|Text|Text|Text|Text|jesse|30-JAN-2019 12.58.51.00 PM||||"] 
| eval msg=mvindex(split(_raw,"#"),2), No=mvindex(split(_raw,"#"),0) 
| eval split_tmp=if(No=1,split(msg,","),split(msg,"|")) 
| eval Customer_ID=case(No=1,mvindex(split_tmp,0),No=2,mvindex(split_tmp,2)) 
| eval Customer_Name=case(No=1,mvindex(split_tmp,-1),No=2,mvindex(split_tmp,9)) 
| eval Purchase_Time=case(No=1,mvindex(split_tmp,2),No=2,null()) 
| eval Closing_Time=case(No=1,null(),No=2,mvindex(split_tmp,10)) 
| stats values(*) as * by Customer_ID 
| table Customer_ID Customer_Name Purchase_Time Closing_Time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 14 Jan 2020 13:35:29 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-01-14T13:35:29Z</dc:date>
    <item>
      <title>how to avoid breaking event order of multi value field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-avoid-breaking-event-order-of-multi-value-field/m-p/486654#M136114</link>
      <description>&lt;P&gt;Hi community,&lt;/P&gt;

&lt;P&gt;I am wondering, how can i keep the data of multi value field based in the order it happened, when showing it as search result using command like stats. For example, stats list() keeps event order intact. But stats values() sorts the values using lexicographical order.&lt;/P&gt;

&lt;P&gt;Is there any other functions or ways that keeps the event order intact like stats list()?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 17:10:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-avoid-breaking-event-order-of-multi-value-field/m-p/486654#M136114</guid>
      <dc:creator>sharif_ahmmad</dc:creator>
      <dc:date>2020-01-13T17:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to avoid breaking event order of multi value field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-avoid-breaking-event-order-of-multi-value-field/m-p/486655#M136115</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=_internal
| streamstats count
| eval tmp=count."#"._raw
| fields tmp
| table tmp
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, @sharif_ahmmad &lt;BR /&gt;
I often attach the number and fields of &lt;CODE&gt;streamstats&lt;/CODE&gt; as in the example, and separate them later.&lt;BR /&gt;
If there are many duplicate values in &lt;CODE&gt;stats list ()&lt;/CODE&gt;, create it temporarily before using &lt;CODE&gt;stats value ()&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;It is more difficult to maintain the order of the fields than the order of the events.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 19:10:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-avoid-breaking-event-order-of-multi-value-field/m-p/486655#M136115</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-13T19:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to avoid breaking event order of multi value field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-avoid-breaking-event-order-of-multi-value-field/m-p/486656#M136116</link>
      <description>&lt;P&gt;Hi @to4kawa , here is what i find after running the commands,&lt;/P&gt;

&lt;P&gt;1##121,5646435,2019-01-30 12:44:54,2019-01-30 12:56:58,jesse&lt;/P&gt;

&lt;P&gt;2##5654655|CommonText|121|45453235|Some Text|Text|Text|Text|Text|jesse|30-JAN-2019 12.58.51.00 PM||||&lt;/P&gt;

&lt;P&gt;Now this may not relevant to original question but how do i extract from this two line of text? Having trouble with this. Can't seem to extract the dates no matter what.&lt;/P&gt;

&lt;P&gt;What i want is to extract &lt;EM&gt;2019-01-33 12:44:54&lt;/EM&gt; from 1st row and &lt;EM&gt;30-JAN-2019 12.58.51.00 PM&lt;/EM&gt; from second row and then show them in the same row in output result. Like this?&lt;/P&gt;

&lt;P&gt;Customer ID     Customer Name         Purchase Time                    Closing Time            &lt;/P&gt;

&lt;P&gt;121                           jesse                     2019-01-30 12:44:54                30-JAN-2019 12.58.51.00 PM        &lt;/P&gt;

&lt;P&gt;How do i do that?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 06:35:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-avoid-breaking-event-order-of-multi-value-field/m-p/486656#M136116</guid>
      <dc:creator>sharif_ahmmad</dc:creator>
      <dc:date>2020-01-14T06:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to avoid breaking event order of multi value field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-avoid-breaking-event-order-of-multi-value-field/m-p/486657#M136117</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="1##121,5646435,2019-01-30 12:44:54,2019-01-30 12:56:58,jesse" 
| appendpipe 
    [ eval _raw="2##5654655|CommonText|121|45453235|Some Text|Text|Text|Text|Text|jesse|30-JAN-2019 12.58.51.00 PM||||"] 
| rex "^(?:1##)(?&amp;lt;Customer_ID&amp;gt;\d+),\d+,(?&amp;lt;Purchase_Time&amp;gt;\d{4}-\d\d-\d\d \d\d:\d\d:\d\d),.+,(?&amp;lt;Customer_Name&amp;gt;\w+$)"
| rex "^(?:2##)\d+\|\w+\|(?&amp;lt;Customer_ID&amp;gt;\d+)\|.*\|(?&amp;lt;Customer_Name&amp;gt;\w+)\|(?&amp;lt;Closing_Time&amp;gt;\d\d-\w+-\d{4} \d\d\.\d\d\.\d\d\.\d\d \w\w)\|*\|*\|*\|$"
| stats values(*) as * by Customer_ID
| table Customer_ID Customer_Name Purchase_Time Closing_Time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Regular expressions are hard.&lt;/P&gt;

&lt;P&gt;Hi, @sharif_ahmmad&lt;BR /&gt;
How about this?&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;ALT:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="1##121,5646435,2019-01-30 12:44:54,2019-01-30 12:56:58,jesse" 
| appendpipe 
    [ eval _raw="2##5654655|CommonText|121|45453235|Some Text|Text|Text|Text|Text|jesse|30-JAN-2019 12.58.51.00 PM||||"] 
| eval msg=mvindex(split(_raw,"#"),2), No=mvindex(split(_raw,"#"),0) 
| eval split_tmp=if(No=1,split(msg,","),split(msg,"|")) 
| eval Customer_ID=case(No=1,mvindex(split_tmp,0),No=2,mvindex(split_tmp,2)) 
| eval Customer_Name=case(No=1,mvindex(split_tmp,-1),No=2,mvindex(split_tmp,9)) 
| eval Purchase_Time=case(No=1,mvindex(split_tmp,2),No=2,null()) 
| eval Closing_Time=case(No=1,null(),No=2,mvindex(split_tmp,10)) 
| stats values(*) as * by Customer_ID 
| table Customer_ID Customer_Name Purchase_Time Closing_Time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Jan 2020 13:35:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-avoid-breaking-event-order-of-multi-value-field/m-p/486657#M136117</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-14T13:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to avoid breaking event order of multi value field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-avoid-breaking-event-order-of-multi-value-field/m-p/486658#M136118</link>
      <description>&lt;P&gt;@to4kawa Thanks a lot. Really Appreciate your effort.  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2020 05:06:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-avoid-breaking-event-order-of-multi-value-field/m-p/486658#M136118</guid>
      <dc:creator>sharif_ahmmad</dc:creator>
      <dc:date>2020-01-15T05:06:11Z</dc:date>
    </item>
  </channel>
</rss>

