<?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: Is there a sort option for the transaction command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-sort-option-for-the-transaction-command/m-p/488524#M136467</link>
    <description>&lt;P&gt;Thanks.  I made one minor change&lt;/P&gt;

&lt;P&gt;index=network sourcetype="forescout:audit" partOf=* &lt;BR /&gt;
| sort 0 _time -numPart partOf &lt;BR /&gt;
| transaction fields=partOf maxspan=1s keeporphans=t &lt;/P&gt;

&lt;P&gt;and am getting the events I'm looking for along with the part order being correct.&lt;/P&gt;</description>
    <pubDate>Mon, 09 Mar 2020 19:28:08 GMT</pubDate>
    <dc:creator>jwhughes58</dc:creator>
    <dc:date>2020-03-09T19:28:08Z</dc:date>
    <item>
      <title>Is there a sort option for the transaction command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-sort-option-for-the-transaction-command/m-p/488519#M136462</link>
      <description>&lt;P&gt;I'm working with ForeScout Audit Policy events.  Some of them have this in the message, Part (1/n), Part (2/n), and so on.  I'm using the transaction command below to join the parts.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=network sourcetype="forescout:audit" partOf=*
| transaction fields=partOf maxspan=1s
| search eventtype=fs_policy_change
| append [search index=network sourcetype=forescout:audit NOT partOf=* eventtype=fs_policy_change]
| sort - _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The field partOf is set in default/transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[fs_get_parts]
REGEX = \|\sPart\s\((?&amp;lt;numPart&amp;gt;\d{1,3})\/(?&amp;lt;partOf&amp;gt;\d{1,3})\)\s\|
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The append adds the single event policy changes.  The issue is the order is sometimes correct and other times not.  For example I will get Part (4/4), Part (2/4), Part (1/4), and Part (3/4) for some of the transactions and others in the correct order.  I didn't see anything in the transaction command to allow me to sort the partOf.  Any ideas?&lt;/P&gt;

&lt;P&gt;Splunk Enterprise 7.2.5.1&lt;/P&gt;

&lt;P&gt;TIA,&lt;BR /&gt;
Joe&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 19:58:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-sort-option-for-the-transaction-command/m-p/488519#M136462</guid>
      <dc:creator>jwhughes58</dc:creator>
      <dc:date>2020-03-06T19:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a sort option for the transaction command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-sort-option-for-the-transaction-command/m-p/488520#M136463</link>
      <description>&lt;P&gt;Ditch &lt;CODE&gt;transaction&lt;/CODE&gt;; try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="network" AND sourcetype="forescout:audit" AND "partOf"="*"
| rex "Part \((?&amp;lt;ThisPart&amp;gt;\d+)\/"
| sort 0 ThisPart partOf
| stats min(_time) AS _time count range(_time) AS duration list(_raw) AS events values(eventtype) AS eventtype BY partOf
| search eventtype="fs_policy_change"
| sort 0 - _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't know what the rest is supposed to do but whatever it is, don't do it with &lt;CODE&gt;append&lt;/CODE&gt;.  Also, NEVER use &lt;CODE&gt;sort&lt;/CODE&gt; without a number after it; otherwise it will truncate your results set.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 20:19:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-sort-option-for-the-transaction-command/m-p/488520#M136463</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-06T20:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a sort option for the transaction command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-sort-option-for-the-transaction-command/m-p/488521#M136464</link>
      <description>&lt;P&gt;This won't work.  This is the output I get&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Feb 28 23:10:05 hostname CounterACT[16202]: | Part (2/2) | ***
Mar  4 17:00:36 hostname CounterACT[16202]: | Part (2/2) |  ***
Feb 28 23:11:28 hostname CounterACT[16202]: | Part (2/2) | ***
Mar  5 18:40:57 hostname CounterACT[16202]: | Part (2/2) | ***
Mar  5 18:40:57 hostname CounterACT[16202]: | Part (1/2) | ***
Mar  4 17:00:36 hostname CounterACT[16202]: | Part (1/2) | ***
Feb 28 23:11:28 hostname CounterACT[16202]: | Part (1/2) | ***
Feb 28 23:10:05 hostname CounterACT[16202]: | Part (1/2) | ***
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It needs to be &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    Mar  5 18:40:57 hostname CounterACT[16202]: | Part (1/2) | ***
    Mar  5 18:40:57 hostname CounterACT[16202]: | Part (2/2) | ***
    Mar  4 17:00:36 hostname CounterACT[16202]: | Part (1/2) | ***
    Mar  4 17:00:36 hostname CounterACT[16202]: | Part (2/2) | ***
    Feb 28 23:11:28 hostname CounterACT[16202]: | Part (1/2) | ***
    Feb 28 23:11:28 hostname CounterACT[16202]: | Part (2/2) | ***
    Feb 28 23:10:05 hostname CounterACT[16202]: | Part (1/2) | ***
    Feb 28 23:10:05 hostname CounterACT[16202]: | Part (2/2) | ***
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where each 1/2 pair is a separate event.  For example one event using my original search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Mar  6 20:32:51 hostname CounterACT[16202]: | Part (1/2) | Message part 1 of 2
Mar  6 20:32:51 hostname CounterACT[16202]: | Part (2/2) | Message part 2 of 2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need the transaction to group the multi-part event into one event.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 20:50:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-sort-option-for-the-transaction-command/m-p/488521#M136464</guid>
      <dc:creator>jwhughes58</dc:creator>
      <dc:date>2020-03-06T20:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a sort option for the transaction command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-sort-option-for-the-transaction-command/m-p/488522#M136465</link>
      <description>&lt;P&gt;I had my &lt;CODE&gt;sort&lt;/CODE&gt; wrong.  I edited and fixed it, try again.  I also added some &lt;CODE&gt;_time&lt;/CODE&gt; stuff.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 22:50:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-sort-option-for-the-transaction-command/m-p/488522#M136465</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-06T22:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a sort option for the transaction command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-sort-option-for-the-transaction-command/m-p/488523#M136466</link>
      <description>&lt;P&gt;sample:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="Time,Host,Couter,Part,Message
Mar  5 18:40:57,hostname,CounterACT[16202]: | ,Part (1/2) ,| ***
Mar  5 18:40:57,hostname,CounterACT[16202]: | ,Part (2/2) ,| ***
Mar  4 17:00:36,hostname,CounterACT[16202]: | ,Part (1/2) ,| ***
Mar  4 17:00:36,hostname,CounterACT[16202]: | ,Part (2/2) ,| ***
Feb 28 23:11:28,hostname,CounterACT[16202]: | ,Part (1/2) ,| ***
Feb 28 23:11:28,hostname,CounterACT[16202]: | ,Part (2/2) ,| ***
Feb 28 23:11:31,hostname,CounterACT[16202]: | ,Part  ,| ***
Feb 28 23:10:05,hostname,CounterACT[16202]: | ,Part (1/2) ,| ***
Feb 28 23:10:05,hostname,CounterACT[16202]: | ,Part (2/2) ,| ***" 
| multikv forceheader=1 
| table Time,Host,Couter,Part,Message 
| rex field=Part "\((?&amp;lt;numPart&amp;gt;\d{1,3})\/(?&amp;lt;partOf&amp;gt;\d{1,3})\)" 
| eval _time=strptime(Time,"%B %d %T") 
| sort 0 _time numPart partOf 
| transaction fields=partOf maxspan=1s keeporphans=t
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Recommend:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=network sourcetype="forescout:audit" eventtype=fs_policy_change
| sort 0 _time numPart partOf
| transaction fields=partOf maxspan=1s keeporphans=t
| reverse
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 07 Mar 2020 00:29:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-sort-option-for-the-transaction-command/m-p/488523#M136466</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-07T00:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a sort option for the transaction command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-sort-option-for-the-transaction-command/m-p/488524#M136467</link>
      <description>&lt;P&gt;Thanks.  I made one minor change&lt;/P&gt;

&lt;P&gt;index=network sourcetype="forescout:audit" partOf=* &lt;BR /&gt;
| sort 0 _time -numPart partOf &lt;BR /&gt;
| transaction fields=partOf maxspan=1s keeporphans=t &lt;/P&gt;

&lt;P&gt;and am getting the events I'm looking for along with the part order being correct.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 19:28:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-sort-option-for-the-transaction-command/m-p/488524#M136467</guid>
      <dc:creator>jwhughes58</dc:creator>
      <dc:date>2020-03-09T19:28:08Z</dc:date>
    </item>
  </channel>
</rss>

