<?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 Transaction not grouping subsequent filter strings in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Transaction-not-grouping-subsequent-filter-strings/m-p/564310#M196580</link>
    <description>&lt;P&gt;I am trying to find the occurrence whenever the state changes due to the error. Below are my sample events:&lt;/P&gt;&lt;P&gt;2021/08/01 07:12:12.098 host=12345 In&lt;BR /&gt;2021/08/01 07:13:12.098 host=12345 In&lt;BR /&gt;2021/08/01 07:14:12.098 host=12345 Out&lt;BR /&gt;2021/08/01 07:15:12.098 host=12345 Out&lt;BR /&gt;2021/08/01 07:16:12.098 host=12345 In&lt;BR /&gt;2021/08/01 07:17:12.098 host=12345 In&lt;BR /&gt;&lt;SPAN&gt;2021/08/01 07:18:12.098 host=12345 Out&lt;BR /&gt;2021/08/01 07:18:35.098 host=12345 ERROR&lt;BR /&gt;&lt;/SPAN&gt;2021/08/01 07:19:12.098 host=12345 In&lt;BR /&gt;2021/08/01 07:20:12.098 host=12345 Out&lt;/P&gt;&lt;P&gt;I need to group the events when the state (In/Out) changed due an ERROR event. For the above sample events, I should not get any result. Because, when the ERROR event happened, the host is already in "Out" stage. We need to monitor only when a "In" host changes to "Out" due to an ERROR.&lt;/P&gt;&lt;P&gt;I tried the below search&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=myindex ("Cut-In" OR "Cut-Out" OR "ERROR")
| rex "host=(?&amp;lt;host&amp;gt;\d+) (?&amp;lt;State&amp;gt;.*)"
| transaction host startswith="State=In" endswith="Out" maxspan=24h
| where searchmatch("ERROR")
| table _time host&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the above query returns a result by grouping the "In" state which logged at "07:16:12" as start of the transaction and "07:20:12" as end of the transaction. This is not a valid scenario.&lt;/P&gt;&lt;P&gt;Please help me in framing the logic.&lt;/P&gt;</description>
    <pubDate>Mon, 23 Aug 2021 12:01:23 GMT</pubDate>
    <dc:creator>Naren26</dc:creator>
    <dc:date>2021-08-23T12:01:23Z</dc:date>
    <item>
      <title>Transaction not grouping subsequent filter strings</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-not-grouping-subsequent-filter-strings/m-p/564310#M196580</link>
      <description>&lt;P&gt;I am trying to find the occurrence whenever the state changes due to the error. Below are my sample events:&lt;/P&gt;&lt;P&gt;2021/08/01 07:12:12.098 host=12345 In&lt;BR /&gt;2021/08/01 07:13:12.098 host=12345 In&lt;BR /&gt;2021/08/01 07:14:12.098 host=12345 Out&lt;BR /&gt;2021/08/01 07:15:12.098 host=12345 Out&lt;BR /&gt;2021/08/01 07:16:12.098 host=12345 In&lt;BR /&gt;2021/08/01 07:17:12.098 host=12345 In&lt;BR /&gt;&lt;SPAN&gt;2021/08/01 07:18:12.098 host=12345 Out&lt;BR /&gt;2021/08/01 07:18:35.098 host=12345 ERROR&lt;BR /&gt;&lt;/SPAN&gt;2021/08/01 07:19:12.098 host=12345 In&lt;BR /&gt;2021/08/01 07:20:12.098 host=12345 Out&lt;/P&gt;&lt;P&gt;I need to group the events when the state (In/Out) changed due an ERROR event. For the above sample events, I should not get any result. Because, when the ERROR event happened, the host is already in "Out" stage. We need to monitor only when a "In" host changes to "Out" due to an ERROR.&lt;/P&gt;&lt;P&gt;I tried the below search&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=myindex ("Cut-In" OR "Cut-Out" OR "ERROR")
| rex "host=(?&amp;lt;host&amp;gt;\d+) (?&amp;lt;State&amp;gt;.*)"
| transaction host startswith="State=In" endswith="Out" maxspan=24h
| where searchmatch("ERROR")
| table _time host&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the above query returns a result by grouping the "In" state which logged at "07:16:12" as start of the transaction and "07:20:12" as end of the transaction. This is not a valid scenario.&lt;/P&gt;&lt;P&gt;Please help me in framing the logic.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 12:01:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-not-grouping-subsequent-filter-strings/m-p/564310#M196580</guid>
      <dc:creator>Naren26</dc:creator>
      <dc:date>2021-08-23T12:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction not grouping subsequent filter strings</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-not-grouping-subsequent-filter-strings/m-p/564315#M196583</link>
      <description>&lt;P&gt;Try something like this - note that 07:13 - 07:14 appears as a transaction and 07:12 - 07:15 is an outer transaction which may or may not be what you want, but given this is dummy data, this may just be a quirk of the example you made up.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval _raw="2021/08/01 07:12:12.098 host=12345 In
2021/08/01 07:13:12.098 host=12345 In
2021/08/01 07:14:12.098 host=12345 Out
2021/08/01 07:15:12.098 host=12345 Out
2021/08/01 07:16:12.098 host=12345 In
2021/08/01 07:17:12.098 host=12345 In
2021/08/01 07:18:12.098 host=12345 Out
2021/08/01 07:18:35.098 host=12345 ERROR
2021/08/01 07:19:12.098 host=12345 In
2021/08/01 07:20:12.098 host=12345 Out"
| multikv noheader=t 
| table _raw



| rex "(?&amp;lt;datetime&amp;gt;.*)\shost=(?&amp;lt;host&amp;gt;\d+)\s(?&amp;lt;State&amp;gt;.*)"
| eval _time=strptime(datetime,"%Y/%m/%d %H:%M:%S.%Q")
| sort 0 - _time
| transaction host startswith="State=In" endswith="Out" maxspan=24h&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 23 Aug 2021 12:29:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-not-grouping-subsequent-filter-strings/m-p/564315#M196583</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-08-23T12:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction not grouping subsequent filter strings</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-not-grouping-subsequent-filter-strings/m-p/564702#M196708</link>
      <description>&lt;P&gt;This is not working too. I am still getting the event which should not be picked&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2021 12:55:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-not-grouping-subsequent-filter-strings/m-p/564702#M196708</guid>
      <dc:creator>Naren26</dc:creator>
      <dc:date>2021-08-25T12:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction not grouping subsequent filter strings</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-not-grouping-subsequent-filter-strings/m-p/564704#M196710</link>
      <description>&lt;P&gt;Given that the runanywhere example works, how does your real data differ from the example?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2021 12:59:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-not-grouping-subsequent-filter-strings/m-p/564704#M196710</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-08-25T12:59:12Z</dc:date>
    </item>
  </channel>
</rss>

