<?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: Having issues with rex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Having-issues-with-rex/m-p/60019#M14769</link>
    <description>&lt;P&gt;The rex does extract the data but the strange part is its not the correct fields. Its mixing the data from the Function field and few other fields.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Dec 2012 15:55:52 GMT</pubDate>
    <dc:creator>theouhuios</dc:creator>
    <dc:date>2012-12-12T15:55:52Z</dc:date>
    <item>
      <title>Having issues with rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-issues-with-rex/m-p/60016#M14766</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;I am not that comfortable yet with rex commands and have been slowly learning it.I want to rex some data from this _raw and facing some issues with it.&lt;/P&gt;

&lt;P&gt;I need the bolded datapoints from this raw. &lt;/P&gt;

&lt;P&gt;6-Dec-12,R18541,,APPROVED,HDG,,3953,CS,&lt;STRONG&gt;Digital Support&lt;/STRONG&gt;,NO,VIRTUAL REUSE,ISCW,&lt;STRONG&gt;2&lt;/STRONG&gt;,WINDOWS,&lt;STRONG&gt;4&lt;/STRONG&gt;,&lt;STRONG&gt;4&lt;/STRONG&gt;,,5297,,,,8,8,8192,12,2012&lt;/P&gt;

&lt;P&gt;The rex which I am using to get the first data point is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "\d+-\w+-\d{2},\[A-Z]d+,,\[A-Z]*,\[A-Z]*,,\d+,\w*,(?&amp;lt;Function&amp;gt;)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I may be completely wrong too. Can anyone please tell me where am I doing mistake here&lt;/P&gt;

&lt;P&gt;More data&lt;/P&gt;

&lt;P&gt;6-Dec-12,R18541,,APPROVED,HDG,,3953,CS,Digital Support,NO,VIRTUAL REUSE,ISCW,2,WINDOWS,4,4,,5297,,,,8,8,8192,12,2012&lt;/P&gt;

&lt;P&gt;6-Dec-12,R18541,,APPROVED,HDG,,3953,CS,Digital Support,NO,VIRTUAL REUSE,ISCE,2,WINDOWS,4,4,,5297,,,,8,8,8192,12,2012&lt;/P&gt;

&lt;P&gt;6-Dec-12,R18541,,APPROVED,HDG,,3953,CS,Digital Support,NO,VIRTUAL REUSE,ISCC,2,WINDOWS,4,4,,5297,,,,8,8,8192,12,2012&lt;/P&gt;

&lt;P&gt;5-Dec-12,r16775,,APPROVED,HDG,,2609,st,Computing Environment,YES,VIRTUAL REUSE,ISCE,1,WINDOWS,1,2,,5252,,,,1,2,2048,12,2012&lt;/P&gt;

&lt;P&gt;5-Dec-12,R19295,,APPROVED,TCIM,,4255,GFS,Billing &amp;amp; Payments Solution Center,NO,VIRTUAL REUSE,TEST CENTER,3,LINUX,2,8,,5123,,,,6,24,24576,12,2012&lt;/P&gt;

&lt;P&gt;5-Dec-12,R16804,,APPROVED,TCIM,,3578,ST,UNIFIED COMMUNICATIONS,NO,VIRTUAL REUSE,TEST CENTER,1,LINUX,4,12,,5121,,,,4,12,12288,12,2012&lt;/P&gt;

&lt;P&gt;5-Dec-12,C02088,,APPROVED,TCIM,,,ST,Computing Environment,NO,VIRTUAL REUSE,TEST CENTER,2,WINDOWS,1,2,,5264,,,,2,4,4096,12,2012&lt;/P&gt;

&lt;P&gt;5-Dec-12,R19462,,APPROVED,TCIM,,4222,CCS,,NO,VIRTUAL REUSE,TEST CENTER,2,WINDOWS,2,4,,5289,,,,4,8,8192,12,2012&lt;/P&gt;

&lt;P&gt;5-Dec-12,R19462,,APPROVED,TCIM,,4222,CCS,,NO,VIRTUAL REUSE,TEST CENTER,1,WINDOWS,4,8,,5289,,,,4,8,8192,12,2012&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2012 19:32:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-issues-with-rex/m-p/60016#M14766</guid>
      <dc:creator>theouhuios</dc:creator>
      <dc:date>2012-12-11T19:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Having issues with rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-issues-with-rex/m-p/60017#M14767</link>
      <description>&lt;P&gt;Any idea on how to solve this? I am still stuck&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2012 14:26:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-issues-with-rex/m-p/60017#M14767</guid>
      <dc:creator>theouhuios</dc:creator>
      <dc:date>2012-12-12T14:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: Having issues with rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-issues-with-rex/m-p/60018#M14768</link>
      <description>&lt;P&gt;Your field name "Function" doesn't capture anything.  You would need to include a [\w\s]+ inside the closing parenthesis to extract data for the field.&lt;/P&gt;

&lt;P&gt;However, your regex probably doesn't need to be this complex.  It looks like you're analyzing comma-separated data.  If you always have the same number of comma-separated fields, and you always need to extract the 9th, 13th, and 15th fields, you can do something like this:&lt;/P&gt;

&lt;P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;BR /&gt;
rex field=_raw "([^,]+,){8}(?&lt;FUNCTION&gt;[^,]+),([^,]+,){3}(?&lt;FIELD2&gt;[^,]+),([^,]+,){1}(?&lt;FIELD3&gt;[^,]+)"&lt;BR /&gt;
&lt;/FIELD3&gt;&lt;/FIELD2&gt;&lt;/FUNCTION&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;Alternatively, you can use eval's mvfind:&lt;/P&gt;

&lt;P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;BR /&gt;
... | eval allfields=split(_raw,",") | eval Function=mvfind(allfields, 8) | ...&lt;BR /&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;etc.  (These may not be exact, but they should get you started.)&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2012 15:04:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-issues-with-rex/m-p/60018#M14768</guid>
      <dc:creator>cphair</dc:creator>
      <dc:date>2012-12-12T15:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: Having issues with rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-issues-with-rex/m-p/60019#M14769</link>
      <description>&lt;P&gt;The rex does extract the data but the strange part is its not the correct fields. Its mixing the data from the Function field and few other fields.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2012 15:55:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-issues-with-rex/m-p/60019#M14769</guid>
      <dc:creator>theouhuios</dc:creator>
      <dc:date>2012-12-12T15:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: Having issues with rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-issues-with-rex/m-p/60020#M14770</link>
      <description>&lt;P&gt;You have two other fields bolded; the rex is intended to extract all of them.  If you only need Function you can remove the tail end of the regex.  It's hard to tell what the solution is without seeing more data.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2012 16:01:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-issues-with-rex/m-p/60020#M14770</guid>
      <dc:creator>cphair</dc:creator>
      <dc:date>2012-12-12T16:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Having issues with rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-issues-with-rex/m-p/60021#M14771</link>
      <description>&lt;P&gt;Added some more data to my first post. What it's doing is its capturing Funtion but under function its mixing data in the 9th field with data from other fields like 11 and 12.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2012 15:09:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-issues-with-rex/m-p/60021#M14771</guid>
      <dc:creator>theouhuios</dc:creator>
      <dc:date>2012-12-13T15:09:12Z</dc:date>
    </item>
  </channel>
</rss>

