<?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 use the regex matched variables from the first search into the other search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655046#M226286</link>
    <description>&lt;P&gt;The syntax you have used, and indeed the semantics you are attempting is not possible in Splunk. By this I mean, even if you could pass the &lt;U&gt;values&lt;/U&gt; retrieved by the first search into the second search (which you might be able to do with the map command, although I wouldn't recommend it), the use of $ip$ is using a value, when this should be a field (name), and you haven't extracted that field in the second search.&lt;/P&gt;&lt;P&gt;Depending on your actual events, you may be able to do this another way. For example, is there only one ip address associated with each (unique) sid?&lt;/P&gt;&lt;P&gt;If so, you could "attach" the ip to every event with the same sid using eventstats, then count your events by sid, un, ip (although are you expecting this to be anything other than 1?)&lt;/P&gt;</description>
    <pubDate>Mon, 21 Aug 2023 14:54:25 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2023-08-21T14:54:25Z</dc:date>
    <item>
      <title>How to use the regex matched variables from the first search into the other search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655042#M226283</link>
      <description>&lt;P&gt;My first search with regex as following:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;index=bigip "Storefront_v243" | rex ".*Common:(?&amp;lt;&lt;STRONG&gt;sid&lt;/STRONG&gt;&amp;gt;.*?): New session from client IP (?&amp;lt;&lt;STRONG&gt;ip&lt;/STRONG&gt;&amp;gt;.*?) \(ST.*\) at VIP 123.45.78.172"&lt;/P&gt;&lt;P&gt;With my second search, I'll have to reference these two matched fields from the first search&lt;/P&gt;&lt;P&gt;index=bigip "Storefront_v243" |&amp;nbsp;rex "Common:&lt;EM&gt;$sid$&lt;/EM&gt;: Username '(?&amp;lt;un&amp;gt;.*?)' |&amp;nbsp; stats count as nrs by sid, un, &lt;EM&gt;$ip$&lt;/EM&gt; | dedup un &lt;EM&gt;$ip$&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;How can I combine these two search queries into one by using pipe?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 14:37:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655042#M226283</guid>
      <dc:creator>vsasdao</dc:creator>
      <dc:date>2023-08-21T14:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the regex matched variables from the first search into the other search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655046#M226286</link>
      <description>&lt;P&gt;The syntax you have used, and indeed the semantics you are attempting is not possible in Splunk. By this I mean, even if you could pass the &lt;U&gt;values&lt;/U&gt; retrieved by the first search into the second search (which you might be able to do with the map command, although I wouldn't recommend it), the use of $ip$ is using a value, when this should be a field (name), and you haven't extracted that field in the second search.&lt;/P&gt;&lt;P&gt;Depending on your actual events, you may be able to do this another way. For example, is there only one ip address associated with each (unique) sid?&lt;/P&gt;&lt;P&gt;If so, you could "attach" the ip to every event with the same sid using eventstats, then count your events by sid, un, ip (although are you expecting this to be anything other than 1?)&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 14:54:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655046#M226286</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-21T14:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the regex matched variables from the first search into the other search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655066#M226295</link>
      <description>&lt;P&gt;These concerned logs are generated by the external product, the F5 BigIP/APM module, for instance,&lt;/P&gt;&lt;P&gt;This is the event my first search query operates on:&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;FONT face="courier new,courier" size="3"&gt;&lt;SPAN class=""&gt;Aug&lt;/SPAN&gt; &lt;SPAN class=""&gt;21&lt;/SPAN&gt; &lt;SPAN class=""&gt;08:46:02&lt;/SPAN&gt; &lt;SPAN class=""&gt;::ffff:10.0.49.14&lt;/SPAN&gt; &lt;SPAN class=""&gt;notice&lt;/SPAN&gt; &lt;SPAN class=""&gt;tmm1&lt;/SPAN&gt;[&lt;SPAN class=""&gt;21852&lt;/SPAN&gt;]&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;01490500:5:&lt;/SPAN&gt; &lt;SPAN class=""&gt;/Common/Storefront_v243.app/Storefront_v243:Common:&lt;STRONG&gt;&lt;SPAN class=""&gt;aa8ccd2c&lt;/SPAN&gt;&lt;/STRONG&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;New&lt;/SPAN&gt; &lt;SPAN class=""&gt;session&lt;/SPAN&gt; &lt;SPAN class=""&gt;from&lt;/SPAN&gt; &lt;SPAN class=""&gt;client&lt;/SPAN&gt; &lt;SPAN class=""&gt;IP&lt;/SPAN&gt; &lt;SPAN class=""&gt;XX.XXX.88.248&lt;/SPAN&gt; (&lt;SPAN class=""&gt;ST=Oslo/CC=NO/C=EU&lt;/SPAN&gt;) &lt;SPAN class=""&gt;at&lt;/SPAN&gt; &lt;SPAN class=""&gt;VIP&lt;/SPAN&gt; &lt;SPAN&gt;123.45.78.172&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class=""&gt;Listener&lt;/SPAN&gt; &lt;SPAN class=""&gt;/Common/Storefront_v243.app/Storefront_v243_webui_https&lt;/SPAN&gt; (&lt;SPAN class=""&gt;Reputation=Unknown)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;FONT face="courier new,courier" size="3"&gt;&lt;SPAN class=""&gt;host =&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A class="" title="::ffff:10.0.49.14" href="https://splunk.vps.no/en-US/app/VPS/search?q=search%20index%3Dbigip%20aa8ccd2c&amp;amp;sid=1692623145.5498067&amp;amp;display.page.search.mode=smart&amp;amp;dispatch.sample_ratio=1&amp;amp;earliest=%40d&amp;amp;latest=now#" target="_blank" rel="noopener"&gt;::ffff:10.0.49.14&lt;/A&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT face="courier new,courier" size="3"&gt;&lt;SPAN class=""&gt;source =&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A class="" title="/var/log/remote/f5_ltm/::ffff:10.0.49.14/2023/08/21/syslog" href="https://splunk.vps.no/en-US/app/VPS/search?q=search%20index%3Dbigip%20aa8ccd2c&amp;amp;sid=1692623145.5498067&amp;amp;display.page.search.mode=smart&amp;amp;dispatch.sample_ratio=1&amp;amp;earliest=%40d&amp;amp;latest=now#" target="_blank" rel="noopener"&gt;/var/log/remote/f5_ltm/::ffff:10.0.49.14/2023/08/21/syslog&lt;/A&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT face="courier new,courier" size="3"&gt;&lt;SPAN class=""&gt;sourcetype =&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A class="" title="f5:bigip:apm:syslog" href="https://splunk.vps.no/en-US/app/VPS/search?q=search%20index%3Dbigip%20aa8ccd2c&amp;amp;sid=1692623145.5498067&amp;amp;display.page.search.mode=smart&amp;amp;dispatch.sample_ratio=1&amp;amp;earliest=%40d&amp;amp;latest=now#" target="_blank" rel="noopener"&gt;f5:bigip:apm:syslog&lt;/A&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="4"&gt;&lt;SPAN class=""&gt;and the other event from BigIP/APM my second search query operates on:&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;FONT face="courier new,courier" size="3"&gt;&lt;SPAN class=""&gt;Aug&lt;/SPAN&gt; &lt;SPAN class=""&gt;21&lt;/SPAN&gt; &lt;SPAN class=""&gt;08:46:07&lt;/SPAN&gt; &lt;SPAN class=""&gt;::ffff:10.0.49.14&lt;/SPAN&gt; &lt;SPAN class=""&gt;notice&lt;/SPAN&gt; &lt;SPAN class=""&gt;apmd&lt;/SPAN&gt;[&lt;SPAN class=""&gt;14365&lt;/SPAN&gt;]&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;01490010:5:&lt;/SPAN&gt; &lt;SPAN class=""&gt;/Common/Storefront_v243.app/Storefront_v243:Common:&lt;STRONG&gt;&lt;SPAN class=""&gt;aa8ccd2c&lt;/SPAN&gt;&lt;/STRONG&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;Username&lt;/SPAN&gt; 'john.smitch&lt;SPAN class=""&gt;'&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;FONT face="courier new,courier" size="3"&gt;&lt;SPAN class=""&gt;host =&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A class="" title="::ffff:10.0.49.14" href="https://splunk.vps.no/en-US/app/VPS/search?q=search%20index%3Dbigip%20aa8ccd2c&amp;amp;sid=1692623145.5498067&amp;amp;display.page.search.mode=smart&amp;amp;dispatch.sample_ratio=1&amp;amp;earliest=%40d&amp;amp;latest=now#" target="_blank" rel="noopener"&gt;::ffff:10.0.49.14&lt;/A&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT face="courier new,courier" size="3"&gt;&lt;SPAN class=""&gt;source =&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A class="" title="/var/log/remote/f5_ltm/::ffff:10.0.49.14/2023/08/21/syslog" href="https://splunk.vps.no/en-US/app/VPS/search?q=search%20index%3Dbigip%20aa8ccd2c&amp;amp;sid=1692623145.5498067&amp;amp;display.page.search.mode=smart&amp;amp;dispatch.sample_ratio=1&amp;amp;earliest=%40d&amp;amp;latest=now#" target="_blank" rel="noopener"&gt;/var/log/remote/f5_ltm/::ffff:10.0.49.14/2023/08/21/syslog&lt;/A&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT face="courier new,courier" size="3"&gt;&lt;SPAN class=""&gt;sourcetype =&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A class="" title="f5:bigip:apm:syslog" href="https://splunk.vps.no/en-US/app/VPS/search?q=search%20index%3Dbigip%20aa8ccd2c&amp;amp;sid=1692623145.5498067&amp;amp;display.page.search.mode=smart&amp;amp;dispatch.sample_ratio=1&amp;amp;earliest=%40d&amp;amp;latest=now#" target="_blank" rel="noopener"&gt;f5:bigip:apm:syslog&lt;/A&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN class=""&gt;As you can see, the APM Session ID&amp;nbsp;&lt;EM&gt;&lt;SPAN class=""&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;aa8ccd2c&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;/EM&gt;is the jointing key between these two events from the BigIP/APM&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 21 Aug 2023 17:21:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655066#M226295</guid>
      <dc:creator>vsasdao</dc:creator>
      <dc:date>2023-08-21T17:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the regex matched variables from the first search into the other search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655070#M226296</link>
      <description>&lt;P&gt;Is the goal of the search to find out the username and IP of each session ?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;If so, you should be able to do it all in one go.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=bigip "Storefront_v243" 
| rex ".*Common:(?&amp;lt;sid&amp;gt;.*?): New session from client IP (?&amp;lt;ip&amp;gt;.*?) \(ST.*\) at VIP 123.45.78.172"
| rex "Common:(?&amp;lt;sid&amp;gt;.*?): Username '(?&amp;lt;un&amp;gt;.*?)'"
| stats count latest(un) as user latest(ip) as ip by sid&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can dedup by user and ip after that if needed .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 18:21:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655070#M226296</guid>
      <dc:creator>andrew_nelson</dc:creator>
      <dc:date>2023-08-21T18:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the regex matched variables from the first search into the other search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655072#M226298</link>
      <description>&lt;P&gt;Thanks for your inputs. I've tried to follow your thoughts further by checking the Policy result associated with that particular APM Session ID should be &lt;STRONG&gt;Allow&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class=""&gt;Aug&lt;/SPAN&gt; &lt;SPAN class=""&gt;21&lt;/SPAN&gt; &lt;SPAN class=""&gt;07:17:52&lt;/SPAN&gt; &lt;SPAN class=""&gt;::ffff:10.0.49.14&lt;/SPAN&gt; &lt;SPAN class=""&gt;notice&lt;/SPAN&gt; &lt;SPAN class=""&gt;apmd&lt;/SPAN&gt;[&lt;SPAN class=""&gt;14365&lt;/SPAN&gt;]&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;STRONG&gt;014902b8&lt;/STRONG&gt;:5:&lt;/SPAN&gt; &lt;SPAN class=""&gt;/Common/Storefront_v243.app/Storefront_v243:Common:&lt;SPAN class=""&gt;295d141a&lt;/SPAN&gt;:&lt;/SPAN&gt; | &lt;SPAN class=""&gt;Start&lt;/SPAN&gt; (&lt;SPAN class=""&gt;fallback&lt;/SPAN&gt;) | &lt;SPAN class=""&gt;Client&lt;/SPAN&gt; &lt;SPAN class=""&gt;Pre-Check&lt;/SPAN&gt; (&lt;SPAN class=""&gt;Browser&lt;/SPAN&gt;) | &lt;SPAN class=""&gt;Logon&lt;/SPAN&gt; &lt;SPAN class=""&gt;Page&lt;/SPAN&gt;(&lt;SPAN class=""&gt;1&lt;/SPAN&gt;) (&lt;SPAN class=""&gt;fallback&lt;/SPAN&gt;) | &lt;SPAN class=""&gt;Domain&lt;/SPAN&gt; &lt;SPAN class=""&gt;Variable&lt;/SPAN&gt; &lt;SPAN class=""&gt;Assign&lt;/SPAN&gt; (&lt;SPAN class=""&gt;fallback&lt;/SPAN&gt;) | &lt;SPAN class=""&gt;AD&lt;/SPAN&gt; &lt;SPAN class=""&gt;Authentication&lt;/SPAN&gt; (&lt;SPAN class=""&gt;Successful&lt;/SPAN&gt;) | &lt;SPAN class=""&gt;RADIUS&lt;/SPAN&gt; &lt;SPAN class=""&gt;Auth&lt;/SPAN&gt; (&lt;SPAN class=""&gt;Successful&lt;/SPAN&gt;) | &lt;SPAN class=""&gt;Full&lt;/SPAN&gt; &lt;SPAN class=""&gt;Resource&lt;/SPAN&gt; &lt;SPAN class=""&gt;Assign&lt;/SPAN&gt; (&lt;SPAN class=""&gt;fallback&lt;/SPAN&gt;) | &lt;SPAN class=""&gt;Allow&lt;/SPAN&gt; | &lt;SPAN class=""&gt;Ending&lt;/SPAN&gt; &lt;SPAN class=""&gt;is:&lt;/SPAN&gt; &lt;STRONG&gt;&lt;SPAN class=""&gt;Allow&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;P&gt;That is, I'd like to get statistics over username and IP address associated with &lt;EM&gt;&lt;STRONG&gt;Allow/Successful&lt;/STRONG&gt;&lt;/EM&gt; authentications. However, the following search query doesn't work as expected, because the username with failed APM Authentication was also returned.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class=""&gt;Aug&lt;/SPAN&gt; &lt;SPAN class=""&gt;21&lt;/SPAN&gt; &lt;SPAN class=""&gt;17:27:04&lt;/SPAN&gt; &lt;SPAN class=""&gt;::ffff:10.0.49.14&lt;/SPAN&gt; &lt;SPAN class=""&gt;notice&lt;/SPAN&gt; &lt;SPAN class=""&gt;apmd&lt;/SPAN&gt;[&lt;SPAN class=""&gt;14365&lt;/SPAN&gt;]&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;01490005:5:&lt;/SPAN&gt; &lt;SPAN class=""&gt;/Common/Storefront_v243.app/Storefront_v243:Common:&lt;SPAN class=""&gt;2a904a10&lt;/SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;Following&lt;/SPAN&gt; &lt;SPAN class=""&gt;rule&lt;/SPAN&gt; '&lt;SPAN class=""&gt;fallback&lt;/SPAN&gt;' &lt;SPAN class=""&gt;from&lt;/SPAN&gt; &lt;SPAN class=""&gt;item&lt;/SPAN&gt; '&lt;SPAN class=""&gt;AD&lt;/SPAN&gt; &lt;SPAN class=""&gt;Authentication&lt;/SPAN&gt;' &lt;SPAN class=""&gt;to&lt;/SPAN&gt; &lt;SPAN class=""&gt;ending&lt;/SPAN&gt; '&lt;SPAN class=""&gt;Deny'&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class=""&gt;Aug&lt;/SPAN&gt; &lt;SPAN class=""&gt;21&lt;/SPAN&gt; &lt;SPAN class=""&gt;17:27:04&lt;/SPAN&gt; &lt;SPAN class=""&gt;::ffff:10.0.49.14&lt;/SPAN&gt; &lt;SPAN class=""&gt;notice&lt;/SPAN&gt; &lt;SPAN class=""&gt;apmd&lt;/SPAN&gt;[&lt;SPAN class=""&gt;14365&lt;/SPAN&gt;]&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;01490010:5:&lt;/SPAN&gt; &lt;SPAN class=""&gt;/Common/Storefront_v243.app/Storefront_v243:Common:&lt;SPAN class=""&gt;2a904a10&lt;/SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;Username&lt;/SPAN&gt; '&lt;SPAN class=""&gt;&lt;STRONG&gt;&lt;EM&gt;vsasvospush&lt;/EM&gt;&lt;/STRONG&gt;'&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;index=bigip "Storefront_v243" 
| rex ".*Common:(?&amp;lt;sid&amp;gt;.*?): New session from client IP (?&amp;lt;ip&amp;gt;.*?) \(ST.*\) at VIP 123.45.78.172"
| rex "Common:(?&amp;lt;sid&amp;gt;.*?): Username '(?&amp;lt;un&amp;gt;.*?)'"
| rex "Common:(?&amp;lt;sid&amp;gt;.*?):   \| Start \(fallback\) .* ending is: Allow"
| where un != "" 
| stats count latest(un) as user latest(ip) as ip by sid&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 18:57:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655072#M226298</guid>
      <dc:creator>vsasdao</dc:creator>
      <dc:date>2023-08-21T18:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the regex matched variables from the first search into the other search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655075#M226299</link>
      <description>&lt;P&gt;&amp;nbsp;One silly question here, the execution result of &lt;FONT face="courier new,courier"&gt;index=bigip "Storefront_v243"&lt;/FONT&gt; will be piped into this regex&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; rex ".*Common:(?&amp;lt;sid&amp;gt;.*?): New session from client IP (?&amp;lt;ip&amp;gt;.*?) \(ST.*\) at VIP 123.45.78.172"&lt;/LI-CODE&gt;&lt;P&gt;the regex results will only contain any logging lines matching this pattern:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;".*Common:(?&amp;lt;sid&amp;gt;.*?): New session from client IP (?&amp;lt;ip&amp;gt;.*?) \(ST.*\) at VIP 123.45.78.172"&lt;/LI-CODE&gt;&lt;P&gt;When these first RegExp matched results are piped to the next regex:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "Common:(?&amp;lt;sid&amp;gt;.*?): Username '(?&amp;lt;un&amp;gt;.*?)'"&lt;/LI-CODE&gt;&lt;P&gt;it should NOT match anything, shouldn't it? IMO, all the loggings lines matching&amp;nbsp;"&lt;FONT face="courier new,courier"&gt;Common:(?&amp;lt;sid&amp;gt;.*?): Username '(?&amp;lt;un&amp;gt;.*?)'&lt;/FONT&gt;" have already been filtered out with the firstly above mentioned RegExp, right?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 19:17:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655075#M226299</guid>
      <dc:creator>vsasdao</dc:creator>
      <dc:date>2023-08-21T19:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the regex matched variables from the first search into the other search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655091#M226300</link>
      <description>&lt;P&gt;You may be confusing two similar but different commands.&lt;/P&gt;&lt;P&gt;Remember that SPL work by processing a pipeline of events.&lt;/P&gt;&lt;P&gt;The regex command can be used to filter the events based on them matching (or not) the regular expression specified for the field. This will mean the only events which satisfy the criteria defined will be passed on to the next (and subsequent) command(s) in the SPL pipeline.&lt;/P&gt;&lt;P&gt;The rex command can by used to extract information from the specified field (default _raw), into named field(s). It does not remove any events from the pipeline.&lt;/P&gt;&lt;P&gt;If you have two rex commands in your SPL pipeline, each one will process the events passed to it, so in your case, the first rex can extract the sid and ip, whereas the second can extract the sid and un.&lt;/P&gt;&lt;P&gt;In order to "join" these pieces of information into a single event, you can use the stats command with the by clause specifying the common field.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 22:03:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655091#M226300</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-21T22:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the regex matched variables from the first search into the other search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655112#M226312</link>
      <description>&lt;PRE&gt;index=bigip "Storefront_v243" 
| rex ".*Common:(?&amp;lt;sid&amp;gt;.*?): New session from client IP (?&amp;lt;ip&amp;gt;.*?) \(ST.*\) at VIP 123.45.78.172"
| rex "Common:(?&amp;lt;sid&amp;gt;.*?): Username '(?&amp;lt;un&amp;gt;.*?)'"
| rex "Common:(?&amp;lt;sid&amp;gt;.*?):   \| Start \(fallback\) .* ending is: Allow"
| where un != "" 
| stats count latest(un) as user latest(ip) as ip by sid&lt;/PRE&gt;&lt;P&gt;I've tried to collect the &lt;EM&gt;usernames&lt;/EM&gt; and IP addresses associated with all APM sessions whose policy result is &lt;STRONG&gt;Allow&lt;/STRONG&gt;, however, the above mentioned search query didn't work as expected, for instance, it listed username from a &lt;EM&gt;Denied&lt;/EM&gt; session&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 06:47:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655112#M226312</guid>
      <dc:creator>vsasdao</dc:creator>
      <dc:date>2023-08-22T06:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the regex matched variables from the first search into the other search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655126#M226317</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=bigip "Storefront_v243" 
| rex "Common:(?&amp;lt;sid&amp;gt;.*?): New session from client IP (?&amp;lt;ip&amp;gt;.*?) \(ST.*\) at VIP 123.45.78.172"
| rex "Common:(?&amp;lt;sid&amp;gt;.*?): Username '(?&amp;lt;un&amp;gt;.*?)'"
| rex "Common:(?&amp;lt;sid&amp;gt;.*?):   \| Start \(fallback\) .* ending is: (?&amp;lt;ending&amp;gt;Allow)"
| where un != "" 
| stats count latest(un) as user latest(ip) as ip latest(ending) as ending by sid
| where ending=="Allow"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 22 Aug 2023 07:40:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655126#M226317</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-22T07:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the regex matched variables from the first search into the other search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655127#M226318</link>
      <description>&lt;P&gt;Thanks for your suggestion! However it doesn't generate the expected results.&lt;/P&gt;&lt;P&gt;I've also tweaked a bit as following,&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;index=bigip "Storefront_v243" 
| rex ".*Common:(?&amp;lt;sid1&amp;gt;.*?): New session from client IP (?&amp;lt;ip&amp;gt;.*?) \(ST.*\) at VIP 146.72.254.172"
| rex "Common:(?&amp;lt;sid2&amp;gt;.*?): Username '(?&amp;lt;un&amp;gt;.*?)'"
| rex "Common:(?&amp;lt;sid3&amp;gt;.*?):   \| Start \(fallback\) .* ending is: Allow"
| where un != "" AND sid1=sid2 AND sid2=sid3
| stats count latest(un) as user latest(ip) as ip by sid1 sid3&lt;/LI-CODE&gt;&lt;P&gt;it didn't work either&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 08:03:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655127#M226318</guid>
      <dc:creator>vsasdao</dc:creator>
      <dc:date>2023-08-22T08:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the regex matched variables from the first search into the other search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655139#M226324</link>
      <description>&lt;P&gt;Try this (note that Ending is now capitalised as this is how you have shown it in your sample data)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "Common:(?&amp;lt;sid&amp;gt;.*?): New session from client IP (?&amp;lt;ip&amp;gt;.*?) \(ST.*\) at VIP 123.45.78.172"
| rex "Common:(?&amp;lt;sid&amp;gt;.*?): Username '(?&amp;lt;un&amp;gt;.*?)'"
| rex "Common:(?&amp;lt;sid&amp;gt;.*?): \| Start \(fallback\) .* Ending is: (?&amp;lt;ending&amp;gt;Allow)"
| stats count latest(un) as user latest(ip) as ip latest(ending) as ending by sid
| where user != "" AND ending=="Allow"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 22 Aug 2023 09:20:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655139#M226324</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-22T09:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the regex matched variables from the first search into the other search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655204#M226340</link>
      <description>&lt;P&gt;It seems that your suggestion now works much better.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you explain in details why the &lt;EM&gt;where&lt;/EM&gt;-clause should be put after the &lt;EM&gt;stats count&lt;/EM&gt; clause? When I tried to reverse their order, it didn't work as expected&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 16:28:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655204#M226340</guid>
      <dc:creator>vsasdao</dc:creator>
      <dc:date>2023-08-22T16:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the regex matched variables from the first search into the other search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655205#M226341</link>
      <description>&lt;P&gt;The where command applies to all the events currently in the pipeline. Not all events have un matched and extracted from the event, so if you have the where command before the stats, you will remove the events which have the ip and ending fields extracted, so they won't be available to be gathered by the stats command.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 16:32:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-regex-matched-variables-from-the-first-search/m-p/655205#M226341</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-22T16:32:15Z</dc:date>
    </item>
  </channel>
</rss>

