<?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 get 2 values out of a string using rex command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-2-values-out-of-a-string-using-rex-command/m-p/557888#M158444</link>
    <description>&lt;P&gt;Sorry, tsid and txid are the same I am referring to. ^_^ I will refine my syntax to use your line. Thanks again&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Jun 2021 18:20:37 GMT</pubDate>
    <dc:creator>rilee</dc:creator>
    <dc:date>2021-06-30T18:20:37Z</dc:date>
    <item>
      <title>How to get 2 values out of a string using rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-2-values-out-of-a-string-using-rex-command/m-p/557829#M158423</link>
      <description>&lt;P&gt;I have the following sample data returned that I'd like to extract 2 fields out of it:&amp;nbsp;&lt;SPAN&gt;1) The value after the "T "&amp;nbsp; and before the "&lt;SPAN class="t"&gt;EmployeeController.Post&lt;/SPAN&gt; &lt;SPAN class="t"&gt;-"&lt;/SPAN&gt; will be the first field &amp;lt;&lt;FONT color="#FF0000"&gt;tsid&lt;/FONT&gt;&amp;gt;.&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;2) Between the "&lt;SPAN&gt;&lt;SPAN class="t"&gt;EmployeeController.&lt;/SPAN&gt;&lt;/SPAN&gt;Post - " and " - End" will be the second field &lt;FONT color="#339966"&gt;&lt;FONT color="#000000"&gt;&amp;lt;&lt;/FONT&gt;duration&lt;FONT color="#000000"&gt;&amp;gt;.&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN class="t"&gt;06/30/21&lt;/SPAN&gt; &lt;SPAN class="t"&gt;09:39:21.39&lt;/SPAN&gt; &lt;SPAN class="t"&gt;p17872&lt;/SPAN&gt;&lt;SPAN&gt; [&lt;/SPAN&gt;&lt;SPAN class="t"&gt;00226&lt;/SPAN&gt;&lt;SPAN&gt;] &lt;/SPAN&gt;&lt;SPAN class="t"&gt;T&lt;/SPAN&gt; &lt;FONT color="#FF00FF"&gt;&lt;SPAN class="t a"&gt;&lt;SPAN class="t"&gt;ELBJsZX6wk68nXrUKKEd4g&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt; &lt;SPAN class="t"&gt;EmployeeController.Post&lt;/SPAN&gt; &lt;SPAN class="t"&gt;-&lt;/SPAN&gt; &lt;FONT color="#339966"&gt;&lt;SPAN class="t"&gt;00:00:00:538&lt;/SPAN&gt;&lt;/FONT&gt; &lt;SPAN class="t"&gt;-&lt;/SPAN&gt; &lt;SPAN class="t"&gt;End&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="t"&gt;Your help is highly appreciated.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 14:51:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-2-values-out-of-a-string-using-rex-command/m-p/557829#M158423</guid>
      <dc:creator>rilee</dc:creator>
      <dc:date>2021-06-30T14:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to get 2 values out of a string using rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-2-values-out-of-a-string-using-rex-command/m-p/557877#M158439</link>
      <description>&lt;P&gt;This is very straightforward so I'm interested in seeing what you've tried and help determine why it didn't work.&lt;/P&gt;&lt;P&gt;At search time, this can be done with two separate regexes:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "] T (?&amp;lt;tsid&amp;gt;\S+)"
| rex "EmployeeController.Post - (?&amp;lt;duration&amp;gt;\S+)"&lt;/LI-CODE&gt;&lt;P&gt;or with a single regex:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "] T (?&amp;lt;tsid&amp;gt;\S+) EmployeeController.Post - (?&amp;lt;duration&amp;gt;\S+)"&lt;/LI-CODE&gt;&lt;P&gt;At index-time, use the latter regex.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 18:05:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-2-values-out-of-a-string-using-rex-command/m-p/557877#M158439</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-06-30T18:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to get 2 values out of a string using rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-2-values-out-of-a-string-using-rex-command/m-p/557886#M158443</link>
      <description>&lt;P&gt;In my base index search, I added&amp;nbsp; "&lt;STRONG&gt;EmployeeController.Post"&lt;/STRONG&gt; &lt;STRONG&gt;"- End"&lt;/STRONG&gt;&amp;nbsp;filter values to return only the lines I need.&lt;/P&gt;&lt;P&gt;Then I used&amp;nbsp;&lt;/P&gt;&lt;P&gt;| rex field=_raw "\s+T+\s(?&amp;lt;&lt;FONT color="#FF0000"&gt;txid&lt;/FONT&gt;&amp;gt;.*?)\s+EmployeeController\\.Post\s\\-\s(?&amp;lt;&lt;FONT color="#339966"&gt;duration&lt;/FONT&gt;&amp;gt;.*?)\s\\-\s+End"&lt;/P&gt;&lt;P&gt;|table txid duration&lt;/P&gt;&lt;P&gt;That did work and I have solved my issue just an hour ago!&amp;nbsp;&lt;/P&gt;&lt;P&gt;But yours looks much neater.&amp;nbsp; Thank you so much for your reply.&amp;nbsp; I appreciate it.&amp;nbsp; Practice makes perfection and I shall get better sooner than later.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 18:18:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-2-values-out-of-a-string-using-rex-command/m-p/557886#M158443</guid>
      <dc:creator>rilee</dc:creator>
      <dc:date>2021-06-30T18:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to get 2 values out of a string using rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-2-values-out-of-a-string-using-rex-command/m-p/557888#M158444</link>
      <description>&lt;P&gt;Sorry, tsid and txid are the same I am referring to. ^_^ I will refine my syntax to use your line. Thanks again&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 18:20:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-2-values-out-of-a-string-using-rex-command/m-p/557888#M158444</guid>
      <dc:creator>rilee</dc:creator>
      <dc:date>2021-06-30T18:20:37Z</dc:date>
    </item>
  </channel>
</rss>

