<?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: Rex fields from a log fle in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Rex-fields-from-a-log-fle/m-p/462435#M130374</link>
    <description>&lt;P&gt;Assuming those values always located in the same relative position( 7th value from starting which are enclosed between square brackets), give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search 
| rex "^\[([^\[]+\[){6}[^:]+:(?&amp;lt;id&amp;gt;[^\@]+)@(?&amp;lt;host&amp;gt;\S+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Regex101 example of the regex:  &lt;A href="https://regex101.com/r/1gPnL8/1"&gt;https://regex101.com/r/1gPnL8/1&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Feb 2020 19:19:52 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2020-02-05T19:19:52Z</dc:date>
    <item>
      <title>Rex fields from a log fle</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-fields-from-a-log-fle/m-p/462434#M130373</link>
      <description>&lt;P&gt;I have the log snippet below want to extract id and hostname into 2 different fields &lt;/P&gt;

&lt;P&gt;for example in the expected output from below is&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;id               host
rmk123     abc.bbb.com@hostname.com
rmc143     bdc.ab.cpm@hostname.com
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;[01/05/2020 13:06:21]      BAUAJM_I_30031 Client [CA WAAE Auto:15515][5][&lt;A href="mailto:abc@hostname.com" target="_blank"&gt;abc@hostname.com&lt;/A&gt;:50019:12.304.593.10] [0x80c91100][02/05/2020 13:06:21.8474][0:rmk123@&lt;A href="mailto:abc.bbb.com@hostname.com" target="_blank"&gt;abc.bbb.com@hostname.com&lt;/A&gt; 0] API ID [34] execution started.&lt;/P&gt;

&lt;P&gt;[01/05/2020 13:06:21]      BAUAJM_I_30032 Client [CA WAAE Auto:15509][5][&lt;A href="mailto:bdc.ab.cpm@hostname.com" target="_blank"&gt;bdc.ab.cpm@hostname.com&lt;/A&gt;:12345:19.304.293.10] [0x28bbbfff][02/05/2020 13:06:21.6946][0:rmc143@&lt;A href="mailto:bdc.ab.cpm@hostname.com" target="_blank"&gt;bdc.ab.cpm@hostname.com&lt;/A&gt; 0] API ID [66] execution completed. Total time: 0.132519 seconds.&lt;/P&gt;

&lt;P&gt;Please assist&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:02:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-fields-from-a-log-fle/m-p/462434#M130373</guid>
      <dc:creator>rczone</dc:creator>
      <dc:date>2020-09-30T04:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: Rex fields from a log fle</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-fields-from-a-log-fle/m-p/462435#M130374</link>
      <description>&lt;P&gt;Assuming those values always located in the same relative position( 7th value from starting which are enclosed between square brackets), give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search 
| rex "^\[([^\[]+\[){6}[^:]+:(?&amp;lt;id&amp;gt;[^\@]+)@(?&amp;lt;host&amp;gt;\S+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Regex101 example of the regex:  &lt;A href="https://regex101.com/r/1gPnL8/1"&gt;https://regex101.com/r/1gPnL8/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2020 19:19:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-fields-from-a-log-fle/m-p/462435#M130374</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-02-05T19:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Rex fields from a log fle</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-fields-from-a-log-fle/m-p/462436#M130375</link>
      <description>&lt;P&gt;You can use below regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=&amp;lt;FIELD_NAME&amp;gt; "\[0:(?&amp;lt;id&amp;gt;[a-z0-9]+)@(?&amp;lt;name&amp;gt;[a-z@.]+) 0\]" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Test query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval test="[01/05/2020 13:06:21] BAUAJM_I_30031 Client [CA WAAE Auto:15515][5][abc@hostname.com:50019:12.304.593.10] [0x80c91100][02/05/2020 13:06:21.8474][0:rmk123@abc.bbb.com@hostname.com 0] API ID [34] execution started.&amp;amp;[01/05/2020 13:06:21] BAUAJM_I_30032 Client [CA WAAE Auto:15509][5][bdc.ab.cpm@hostname.com:12345:19.304.293.10] [0x28bbbfff][02/05/2020 13:06:21.6946][0:rmc143@bdc.ab.cpm@hostname.com 0] API ID [66] execution completed. Total time: 0.132519 seconds." | makemv delim="&amp;amp;" test  | mvexpand test | rex field=test "\[0:(?&amp;lt;id&amp;gt;[a-z0-9]+)@(?&amp;lt;name&amp;gt;[a-z@.]+) 0\]" | table id, name, test
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Feb 2020 05:44:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-fields-from-a-log-fle/m-p/462436#M130375</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-02-06T05:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Rex fields from a log fle</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-fields-from-a-log-fle/m-p/462437#M130376</link>
      <description>&lt;P&gt;Hi @rczone&lt;/P&gt;

&lt;P&gt;Try this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval temp="[01/05/2020 13:06:21] BAUAJM_I_30031 Client [CA WAAE Auto:15515][5][abc@hostname.com:50019:12.304.593.10] [0x80c91100][02/05/2020 13:06:21.8474][0:rmk123@abc.bbb.com@hostname.com 0] API ID [34] execution started.,,

[01/05/2020 13:06:21] BAUAJM_I_30032 Client [CA WAAE Auto:15509][5][bdc.ab.cpm@hostname.com:12345:19.304.293.10] [0x28bbbfff][02/05/2020 13:06:21.6946][0:rmc143@bdc.ab.cpm@hostname.com 0] API ID [66] execution completed. Total time: 0.132519 seconds." 
| makemv delim=",," temp 
| mvexpand temp 
| rex field=temp "\[\S:(?P&amp;lt;id&amp;gt;[^\@]+)@(?P&amp;lt;host&amp;gt;[^\]]\S+)" 
| table id, host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Feb 2020 06:31:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-fields-from-a-log-fle/m-p/462437#M130376</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2020-02-06T06:31:25Z</dc:date>
    </item>
  </channel>
</rss>

